1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-27 00:12:01 +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:
Tom Lane
2005-12-06 23:08:34 +00:00
parent 3001b4697d
commit 887a7c61f6
9 changed files with 118 additions and 65 deletions

View File

@@ -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);