1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-17 17:02:08 +03:00

Fixed bug where FlushRelationBuffers() did call StrategyInvalidateBuffer()

for already empty buffers because their buffer tag was not cleard out
when the buffers have been invalidated before.

Also removed the misnamed BM_FREE bufhdr flag and replaced the checks,
which effectively ask if the buffer is unpinned, with checks against the
refcount field.

Jan
This commit is contained in:
Jan Wieck
2004-02-12 15:06:56 +00:00
parent 76f02b51b6
commit fc65a3e1fd
4 changed files with 41 additions and 127 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.158 2004/02/10 03:42:45 tgl Exp $
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.159 2004/02/12 15:06:56 wieck Exp $
*
*-------------------------------------------------------------------------
*/
@ -1190,7 +1190,7 @@ recheck:
* Release any refcount we may have. If someone else has a
* pin on the buffer, we got trouble.
*/
if (!(bufHdr->flags & BM_FREE))
if (bufHdr->refcount != 0)
{
/* the sole pin should be ours */
if (bufHdr->refcount != 1 || PrivateRefCount[i - 1] == 0)
@ -1268,7 +1268,7 @@ recheck:
* The thing should be free, if caller has checked that no
* backends are running in that database.
*/
Assert(bufHdr->flags & BM_FREE);
Assert(bufHdr->refcount == 0);
/*
* And mark the buffer as no longer occupied by this page.
@ -1501,7 +1501,7 @@ FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock)
}
UnpinBuffer(bufHdr);
}
if (!(bufHdr->flags & BM_FREE))
if (bufHdr->refcount != 0)
{
LWLockRelease(BufMgrLock);
error_context_stack = errcontext.previous;