diff options
author | Jan Wieck <JanWieck@Yahoo.com> | 2003-11-13 05:34:58 +0000 |
---|---|---|
committer | Jan Wieck <JanWieck@Yahoo.com> | 2003-11-13 05:34:58 +0000 |
commit | 923e994d7901d7c0268725e219002af3b2d40dfc (patch) | |
tree | 74346d015a246ecb57b4bb4f4c25974f571b3265 /src/backend/storage/buffer/buf_init.c | |
parent | 256d2f09b58c45ad8ddda8f46d22915a8eaa5600 (diff) | |
download | postgresql-923e994d7901d7c0268725e219002af3b2d40dfc.tar.gz postgresql-923e994d7901d7c0268725e219002af3b2d40dfc.zip |
ARC strategy backed out ... sorry
Jan
Diffstat (limited to 'src/backend/storage/buffer/buf_init.c')
-rw-r--r-- | src/backend/storage/buffer/buf_init.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c index 616338c60c6..79683b725c2 100644 --- a/src/backend/storage/buffer/buf_init.c +++ b/src/backend/storage/buffer/buf_init.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.55 2003/11/13 00:40:01 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.56 2003/11/13 05:34:58 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -48,6 +48,9 @@ long *CurTraceBuf; int ShowPinTrace = 0; int Data_Descriptors; +int Free_List_Descriptor; +int Lookup_List_Descriptor; +int Num_Descriptors; BufferDesc *BufferDescriptors; Block *BufferBlockPointers; @@ -130,6 +133,9 @@ InitBufferPool(void) int i; Data_Descriptors = NBuffers; + Free_List_Descriptor = Data_Descriptors; + Lookup_List_Descriptor = Data_Descriptors + 1; + Num_Descriptors = Data_Descriptors + 1; /* * It's probably not really necessary to grab the lock --- if there's @@ -150,7 +156,7 @@ InitBufferPool(void) BufferDescriptors = (BufferDesc *) ShmemInitStruct("Buffer Descriptors", - Data_Descriptors * sizeof(BufferDesc), &foundDescs); + Num_Descriptors * sizeof(BufferDesc), &foundDescs); BufferBlocks = (char *) ShmemInitStruct("Buffer Blocks", @@ -170,14 +176,16 @@ InitBufferPool(void) block = BufferBlocks; /* - * link the buffers into a single linked list. This will become the - * LiFo list of unused buffers returned by StragegyGetBuffer(). + * link the buffers into a circular, doubly-linked list to + * initialize free list, and initialize the buffer headers. Still + * don't know anything about replacement strategy in this file. */ for (i = 0; i < Data_Descriptors; block += BLCKSZ, buf++, i++) { Assert(ShmemIsValid((unsigned long) block)); - buf->bufNext = i + 1; + buf->freeNext = i + 1; + buf->freePrev = i - 1; CLEAR_BUFFERTAG(&(buf->tag)); buf->buf_id = i; @@ -191,12 +199,14 @@ InitBufferPool(void) buf->wait_backend_id = 0; } - /* Correct last entry */ - BufferDescriptors[Data_Descriptors - 1].bufNext = -1; + /* close the circular queue */ + BufferDescriptors[0].freePrev = Data_Descriptors - 1; + BufferDescriptors[Data_Descriptors - 1].freeNext = 0; } /* Init other shared buffer-management stuff */ - StrategyInitialize(!foundDescs); + InitBufTable(); + InitFreeList(!foundDescs); LWLockRelease(BufMgrLock); } |