修改bufferdesc大小,提升性能
This commit is contained in:
@ -191,30 +191,35 @@ typedef struct {
|
||||
* We use this same struct for local buffer headers, but the lock fields
|
||||
* are not used and not all of the flag bits are useful either.
|
||||
*/
|
||||
typedef struct BufferDesc {
|
||||
BufferTag tag; /* ID of page contained in buffer */
|
||||
/* state of the tag, containing flags, refcount and usagecount */
|
||||
pg_atomic_uint32 state;
|
||||
|
||||
typedef struct BufferDescExtra {
|
||||
/* Cached physical location for segment-page storage, used for xlog */
|
||||
uint8 seg_fileno;
|
||||
BlockNumber seg_blockno;
|
||||
|
||||
/* below fields are used for incremental checkpoint */
|
||||
pg_atomic_uint64 rec_lsn; /* recovery LSN */
|
||||
volatile uint64 dirty_queue_loc; /* actual loc of dirty page queue */
|
||||
bool encrypt; /* enable table's level data encryption */
|
||||
|
||||
volatile uint64 lsn_on_disk;
|
||||
|
||||
volatile bool aio_in_progress; /* indicate aio is in progress */
|
||||
} BufferDescExtra;
|
||||
|
||||
typedef struct BufferDesc {
|
||||
BufferTag tag; /* ID of page contained in buffer */
|
||||
int buf_id; /* buffer's index number (from 0) */
|
||||
|
||||
/* state of the tag, containing flags, refcount and usagecount */
|
||||
pg_atomic_uint32 state;
|
||||
|
||||
ThreadId wait_backend_pid; /* backend PID of pin-count waiter */
|
||||
|
||||
LWLock* io_in_progress_lock; /* to wait for I/O to complete */
|
||||
LWLock* content_lock; /* to lock access to buffer contents */
|
||||
|
||||
/* below fields are used for incremental checkpoint */
|
||||
pg_atomic_uint64 rec_lsn; /* recovery LSN */
|
||||
volatile uint64 dirty_queue_loc; /* actual loc of dirty page queue */
|
||||
bool encrypt; /* enable table's level data encryption */
|
||||
|
||||
volatile uint64 lsn_on_disk;
|
||||
BufferDescExtra *extra;
|
||||
|
||||
volatile bool aio_in_progress; /* indicate aio is in progress */
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
volatile uint64 lsn_dirty;
|
||||
#endif
|
||||
@ -240,7 +245,8 @@ typedef struct BufferDesc {
|
||||
* platform with either 32 or 128 byte line sizes, it's good to align to
|
||||
* boundaries and avoid false sharing.
|
||||
*/
|
||||
#define BUFFERDESC_PAD_TO_SIZE (SIZEOF_VOID_P == 8 ? 128 : 1)
|
||||
//#define BUFFERDESC_PAD_TO_SIZE (SIZEOF_VOID_P == 8 ? 128 : 1)
|
||||
#define BUFFERDESC_PAD_TO_SIZE (SIZEOF_VOID_P == 8 ? 64 : 1)
|
||||
|
||||
typedef union BufferDescPadded {
|
||||
BufferDesc bufferdesc;
|
||||
@ -248,12 +254,12 @@ typedef union BufferDescPadded {
|
||||
} BufferDescPadded;
|
||||
|
||||
#define GetBufferDescriptor(id) (&t_thrd.storage_cxt.BufferDescriptors[(id)].bufferdesc)
|
||||
#define GetLocalBufferDescriptor(id) (&t_thrd.storage_cxt.LocalBufferDescriptors[(id)])
|
||||
#define GetLocalBufferDescriptor(id) ((BufferDesc *)&u_sess->storage_cxt.LocalBufferDescriptors[(id)].bufferdesc)
|
||||
#define BufferDescriptorGetBuffer(bdesc) ((bdesc)->buf_id + 1)
|
||||
|
||||
#define BufferGetBufferDescriptor(buffer) \
|
||||
(AssertMacro(BufferIsValid(buffer)), BufferIsLocal(buffer) ? \
|
||||
&u_sess->storage_cxt.LocalBufferDescriptors[-(buffer)-1] : \
|
||||
(BufferDesc *)&u_sess->storage_cxt.LocalBufferDescriptors[-(buffer)-1].bufferdesc : \
|
||||
&t_thrd.storage_cxt.BufferDescriptors[(buffer)-1].bufferdesc)
|
||||
|
||||
#define BufferDescriptorGetContentLock(bdesc) (((bdesc)->content_lock))
|
||||
|
||||
Reference in New Issue
Block a user