mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-01 19:45:33 +08:00
Assert that BufferIsPinned() in IncrBufferRefCount(), rather than using
a home-brewed combination of assertions that boiled down to the same thing.
This commit is contained in:
parent
dec2c77c1f
commit
4acc97d7e4
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* 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)
|
||||
* at least once.
|
||||
*
|
||||
* This function cannot be used on a buffer we do not have pinned,
|
||||
* because it doesn't change the shared buffer state. Therefore the
|
||||
* Assert checks are for refcount > 0. Someone got this wrong once...
|
||||
* because it doesn't change the shared buffer state.
|
||||
*/
|
||||
void
|
||||
IncrBufferRefCount(Buffer buffer)
|
||||
{
|
||||
Assert(BufferIsValid(buffer));
|
||||
Assert(BufferIsPinned(buffer));
|
||||
ResourceOwnerEnlargeBuffers(CurrentResourceOwner);
|
||||
ResourceOwnerRememberBuffer(CurrentResourceOwner, buffer);
|
||||
if (BufferIsLocal(buffer))
|
||||
{
|
||||
Assert(LocalRefCount[-buffer - 1] > 0);
|
||||
LocalRefCount[-buffer - 1]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(PrivateRefCount[buffer - 1] > 0);
|
||||
PrivateRefCount[buffer - 1]++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NOT_USED
|
||||
|
Loading…
Reference in New Issue
Block a user