From fc65a3e1fd1e2bc19d2417ac07e768e7d168fff9 Mon Sep 17 00:00:00 2001 From: Jan Wieck Date: Thu, 12 Feb 2004 15:06:56 +0000 Subject: 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 --- src/backend/storage/buffer/bufmgr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/backend/storage/buffer/bufmgr.c') diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 0ad26ee4f0b..e7435b9534a 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -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; -- cgit v1.2.3