summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorJan Wieck2004-01-15 16:14:26 +0000
committerJan Wieck2004-01-15 16:14:26 +0000
commitdfdd59e91807ddf8dd32885be42a7f3af5a71c64 (patch)
tree0a00e2790e1f5f91487a1f523e03d0c6a741dc88 /src/include
parentcfd7fb7ed4b66da97f88338d991843fa7e2fe59d (diff)
Adjusted calculation of shared memory requirements to new
ARC buffer replacement strategy. Jan
Diffstat (limited to 'src/include')
-rw-r--r--src/include/storage/buf_internals.h48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h
index 9e7864c750..ce4be5439b 100644
--- a/src/include/storage/buf_internals.h
+++ b/src/include/storage/buf_internals.h
@@ -1,13 +1,14 @@
/*-------------------------------------------------------------------------
*
* buf_internals.h
- * Internal definitions for buffer manager.
+ * Internal definitions for buffer manager and the buffer replacement
+ * strategy.
*
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.66 2003/12/14 00:34:47 neilc Exp $
+ * $PostgreSQL: pgsql/src/include/storage/buf_internals.h,v 1.67 2004/01/15 16:14:26 wieck Exp $
*
*-------------------------------------------------------------------------
*/
@@ -135,6 +136,49 @@ typedef struct
Buffer id;
} BufferLookupEnt;
+/*
+ * Definitions for the buffer replacement strategy
+ */
+#define STRAT_LIST_UNUSED -1
+#define STRAT_LIST_B1 0
+#define STRAT_LIST_T1 1
+#define STRAT_LIST_T2 2
+#define STRAT_LIST_B2 3
+#define STRAT_NUM_LISTS 4
+
+/*
+ * The Cache Directory Block (CDB) of the Adaptive Replacement Cache (ARC)
+ */
+typedef struct
+{
+ int prev; /* links in the queue */
+ int next;
+ int list; /* current list */
+ BufferTag buf_tag; /* buffer key */
+ Buffer buf_id; /* currently assigned data buffer */
+ TransactionId t1_xid; /* the xid this entry went onto T1 */
+} BufferStrategyCDB;
+
+/*
+ * The shared ARC control information.
+ */
+typedef struct
+{
+
+ int target_T1_size; /* What T1 size are we aiming for */
+ int listUnusedCDB; /* All unused StrategyCDB */
+ int listHead[STRAT_NUM_LISTS]; /* ARC lists B1, T1, T2 and B2 */
+ int listTail[STRAT_NUM_LISTS];
+ int listSize[STRAT_NUM_LISTS];
+ Buffer listFreeBuffers; /* List of unused buffers */
+
+ long num_lookup; /* Some hit statistics */
+ long num_hit[STRAT_NUM_LISTS];
+ time_t stat_report;
+
+ BufferStrategyCDB cdb[1]; /* The cache directory */
+} BufferStrategyControl;
+
/* counters in buf_init.c */
extern long int ReadBufferCount;
extern long int ReadLocalBufferCount;