diff options
author | Jan Wieck <JanWieck@Yahoo.com> | 2003-11-13 14:57:15 +0000 |
---|---|---|
committer | Jan Wieck <JanWieck@Yahoo.com> | 2003-11-13 14:57:15 +0000 |
commit | 6b86d62b00f150766e1899c98e964b6611c00ee5 (patch) | |
tree | c1baa6c01a358bbea29153682249bb038bd10242 /src/backend/storage/buffer/buf_init.c | |
parent | 923e994d7901d7c0268725e219002af3b2d40dfc (diff) | |
download | postgresql-6b86d62b00f150766e1899c98e964b6611c00ee5.tar.gz postgresql-6b86d62b00f150766e1899c98e964b6611c00ee5.zip |
2nd try for the ARC strategy.
I added a couple more Assertions while tracking down the exact
cause of the former bug.
All 93 regression tests pass now.
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, 8 insertions, 18 deletions
diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c index 79683b725c2..601d4fc6e72 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.56 2003/11/13 05:34:58 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.57 2003/11/13 14:57:15 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -48,9 +48,6 @@ long *CurTraceBuf; int ShowPinTrace = 0; int Data_Descriptors; -int Free_List_Descriptor; -int Lookup_List_Descriptor; -int Num_Descriptors; BufferDesc *BufferDescriptors; Block *BufferBlockPointers; @@ -133,9 +130,6 @@ 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 @@ -156,7 +150,7 @@ InitBufferPool(void) BufferDescriptors = (BufferDesc *) ShmemInitStruct("Buffer Descriptors", - Num_Descriptors * sizeof(BufferDesc), &foundDescs); + Data_Descriptors * sizeof(BufferDesc), &foundDescs); BufferBlocks = (char *) ShmemInitStruct("Buffer Blocks", @@ -176,16 +170,14 @@ InitBufferPool(void) block = BufferBlocks; /* - * 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. + * link the buffers into a single linked list. This will become the + * LiFo list of unused buffers returned by StragegyGetBuffer(). */ for (i = 0; i < Data_Descriptors; block += BLCKSZ, buf++, i++) { Assert(ShmemIsValid((unsigned long) block)); - buf->freeNext = i + 1; - buf->freePrev = i - 1; + buf->bufNext = i + 1; CLEAR_BUFFERTAG(&(buf->tag)); buf->buf_id = i; @@ -199,14 +191,12 @@ InitBufferPool(void) buf->wait_backend_id = 0; } - /* close the circular queue */ - BufferDescriptors[0].freePrev = Data_Descriptors - 1; - BufferDescriptors[Data_Descriptors - 1].freeNext = 0; + /* Correct last entry */ + BufferDescriptors[Data_Descriptors - 1].bufNext = -1; } /* Init other shared buffer-management stuff */ - InitBufTable(); - InitFreeList(!foundDescs); + StrategyInitialize(!foundDescs); LWLockRelease(BufMgrLock); } |