mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Get rid of slru.c's hardwired insistence on a fixed number of slots per
SLRU area. The number of slots is still a compile-time constant (someday we might want to change that), but at least it's a different constant for each SLRU area. Increase number of subtrans buffers to 32 based on experimentation with a heavily subtrans-bashing test case, and increase number of multixact member buffers to 16, since it's obviously silly for it not to be at least twice the number of multixact offset buffers.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/clog.h,v 1.14 2005/08/20 23:26:29 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/clog.h,v 1.15 2005/12/06 23:08:34 tgl Exp $
|
||||
*/
|
||||
#ifndef CLOG_H
|
||||
#define CLOG_H
|
||||
@@ -28,6 +28,10 @@ typedef int XidStatus;
|
||||
#define TRANSACTION_STATUS_SUB_COMMITTED 0x03
|
||||
|
||||
|
||||
/* Number of SLRU buffers to use for clog */
|
||||
#define NUM_CLOG_BUFFERS 8
|
||||
|
||||
|
||||
extern void TransactionIdSetStatus(TransactionId xid, XidStatus status);
|
||||
extern XidStatus TransactionIdGetStatus(TransactionId xid);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/multixact.h,v 1.7 2005/10/15 02:49:42 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/multixact.h,v 1.8 2005/12/06 23:08:34 tgl Exp $
|
||||
*/
|
||||
#ifndef MULTIXACT_H
|
||||
#define MULTIXACT_H
|
||||
@@ -18,6 +18,10 @@
|
||||
|
||||
#define MultiXactIdIsValid(multi) ((multi) != InvalidMultiXactId)
|
||||
|
||||
/* Number of SLRU buffers to use for multixact */
|
||||
#define NUM_MXACTOFFSET_BUFFERS 8
|
||||
#define NUM_MXACTMEMBER_BUFFERS 16
|
||||
|
||||
/* ----------------
|
||||
* multixact-related XLOG entries
|
||||
* ----------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/slru.h,v 1.16 2005/12/06 18:10:06 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/slru.h,v 1.17 2005/12/06 23:08:34 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -16,13 +16,6 @@
|
||||
#include "storage/lwlock.h"
|
||||
|
||||
|
||||
/*
|
||||
* Number of page buffers. Ideally this could be different for CLOG and
|
||||
* SUBTRANS, but the benefit doesn't seem to be worth any additional
|
||||
* notational cruft.
|
||||
*/
|
||||
#define NUM_SLRU_BUFFERS 8
|
||||
|
||||
/*
|
||||
* Page status codes. Note that these do not include the "dirty" bit.
|
||||
* page_dirty can be TRUE only in the VALID or WRITE_IN_PROGRESS states;
|
||||
@@ -44,16 +37,19 @@ typedef struct SlruSharedData
|
||||
{
|
||||
LWLockId ControlLock;
|
||||
|
||||
/* Number of buffers managed by this SLRU structure */
|
||||
int num_slots;
|
||||
|
||||
/*
|
||||
* Info for each buffer slot. Page number is undefined when status is
|
||||
* EMPTY.
|
||||
* Arrays holding info for each buffer slot. Page number is undefined
|
||||
* when status is EMPTY, as is page_lru_count.
|
||||
*/
|
||||
char *page_buffer[NUM_SLRU_BUFFERS];
|
||||
SlruPageStatus page_status[NUM_SLRU_BUFFERS];
|
||||
bool page_dirty[NUM_SLRU_BUFFERS];
|
||||
int page_number[NUM_SLRU_BUFFERS];
|
||||
int page_lru_count[NUM_SLRU_BUFFERS];
|
||||
LWLockId buffer_locks[NUM_SLRU_BUFFERS];
|
||||
char **page_buffer;
|
||||
SlruPageStatus *page_status;
|
||||
bool *page_dirty;
|
||||
int *page_number;
|
||||
int *page_lru_count;
|
||||
LWLockId *buffer_locks;
|
||||
|
||||
/*----------
|
||||
* We mark a page "most recently used" by setting
|
||||
@@ -110,8 +106,8 @@ typedef SlruCtlData *SlruCtl;
|
||||
typedef struct SlruFlushData *SlruFlush;
|
||||
|
||||
|
||||
extern Size SimpleLruShmemSize(void);
|
||||
extern void SimpleLruInit(SlruCtl ctl, const char *name,
|
||||
extern Size SimpleLruShmemSize(int nslots);
|
||||
extern void SimpleLruInit(SlruCtl ctl, const char *name, int nslots,
|
||||
LWLockId ctllock, const char *subdir);
|
||||
extern int SimpleLruZeroPage(SlruCtl ctl, int pageno);
|
||||
extern int SimpleLruReadPage(SlruCtl ctl, int pageno, TransactionId xid);
|
||||
|
||||
@@ -6,11 +6,14 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/subtrans.h,v 1.7 2005/08/20 23:26:29 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/subtrans.h,v 1.8 2005/12/06 23:08:34 tgl Exp $
|
||||
*/
|
||||
#ifndef SUBTRANS_H
|
||||
#define SUBTRANS_H
|
||||
|
||||
/* Number of SLRU buffers to use for subtrans */
|
||||
#define NUM_SUBTRANS_BUFFERS 32
|
||||
|
||||
extern void SubTransSetParent(TransactionId xid, TransactionId parent);
|
||||
extern TransactionId SubTransGetParent(TransactionId xid);
|
||||
extern TransactionId SubTransGetTopmostTransaction(TransactionId xid);
|
||||
|
||||
Reference in New Issue
Block a user