Decrement relation reference count incremented in
RelationIdCacheGetRelation() to flush relations from cache in commit time.
This commit is contained in:
parent
defb10a450
commit
14f81d8d34
2 changed files with 13 additions and 12 deletions
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.26 1997/09/22 07:13:56 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.27 1997/10/12 07:12:02 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -832,6 +832,8 @@ FlushBuffer(Buffer buffer, bool release)
|
|||
|
||||
status = smgrflush(bufHdr->bufsmgr, bufrel, bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
|
||||
RelationDecrementReferenceCount(bufrel);
|
||||
|
||||
if (status == SM_FAIL)
|
||||
{
|
||||
|
@ -1065,15 +1067,8 @@ BufferSync()
|
|||
* were flushing it out we must not clear DIRTY flag -
|
||||
* vadim 01/17/97
|
||||
*/
|
||||
if (bufHdr->flags & BM_JUST_DIRTIED)
|
||||
{
|
||||
elog(NOTICE, "BufferSync: content of block %u (%s) changed while flushing",
|
||||
bufHdr->tag.blockNum, bufHdr->sb_relname);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(bufHdr->flags & BM_JUST_DIRTIED))
|
||||
bufHdr->flags &= ~BM_DIRTY;
|
||||
}
|
||||
if (reln != (Relation) NULL)
|
||||
RelationDecrementReferenceCount(reln);
|
||||
}
|
||||
|
@ -1392,6 +1387,9 @@ BufferReplace(BufferDesc *bufHdr, bool bufferLockHeld)
|
|||
bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
}
|
||||
|
||||
if (reln != (Relation) NULL)
|
||||
RelationDecrementReferenceCount(reln);
|
||||
|
||||
if (status == SM_FAIL)
|
||||
return (FALSE);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.12 1997/09/18 20:21:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.13 1997/10/12 07:12:03 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -127,6 +127,7 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
|
|||
smgrwrite(bufrel->rd_rel->relsmgr, bufrel, bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
LocalBufferFlushCount++;
|
||||
RelationDecrementReferenceCount(bufrel);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -204,7 +205,8 @@ FlushLocalBuffer(Buffer buffer, bool release)
|
|||
smgrflush(bufrel->rd_rel->relsmgr, bufrel, bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
LocalBufferFlushCount++;
|
||||
|
||||
RelationDecrementReferenceCount(bufrel);
|
||||
|
||||
Assert(LocalRefCount[bufid] > 0);
|
||||
if (release)
|
||||
LocalRefCount[bufid]--;
|
||||
|
@ -277,7 +279,8 @@ LocalBufferSync(void)
|
|||
smgrwrite(bufrel->rd_rel->relsmgr, bufrel, buf->tag.blockNum,
|
||||
(char *) MAKE_PTR(buf->data));
|
||||
LocalBufferFlushCount++;
|
||||
|
||||
RelationDecrementReferenceCount(bufrel);
|
||||
|
||||
buf->tag.relId.relId = InvalidOid;
|
||||
buf->flags &= ~BM_DIRTY;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue