Commit 4acc97d7 authored by Neil Conway's avatar Neil Conway

Assert that BufferIsPinned() in IncrBufferRefCount(), rather than using

a home-brewed combination of assertions that boiled down to the same
thing.
parent dec2c77c
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.181 2004/10/17 22:01:50 tgl Exp $ * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.182 2004/11/24 02:56:17 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1549,25 +1549,18 @@ ReleaseBuffer(Buffer buffer) ...@@ -1549,25 +1549,18 @@ ReleaseBuffer(Buffer buffer)
* at least once. * at least once.
* *
* This function cannot be used on a buffer we do not have pinned, * This function cannot be used on a buffer we do not have pinned,
* because it doesn't change the shared buffer state. Therefore the * because it doesn't change the shared buffer state.
* Assert checks are for refcount > 0. Someone got this wrong once...
*/ */
void void
IncrBufferRefCount(Buffer buffer) IncrBufferRefCount(Buffer buffer)
{ {
Assert(BufferIsValid(buffer)); Assert(BufferIsPinned(buffer));
ResourceOwnerEnlargeBuffers(CurrentResourceOwner); ResourceOwnerEnlargeBuffers(CurrentResourceOwner);
ResourceOwnerRememberBuffer(CurrentResourceOwner, buffer); ResourceOwnerRememberBuffer(CurrentResourceOwner, buffer);
if (BufferIsLocal(buffer)) if (BufferIsLocal(buffer))
{
Assert(LocalRefCount[-buffer - 1] > 0);
LocalRefCount[-buffer - 1]++; LocalRefCount[-buffer - 1]++;
}
else else
{
Assert(PrivateRefCount[buffer - 1] > 0);
PrivateRefCount[buffer - 1]++; PrivateRefCount[buffer - 1]++;
}
} }
#ifdef NOT_USED #ifdef NOT_USED
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment