Skip to content
Snippets Groups Projects
Commit a2e8e15d authored by Tom Lane's avatar Tom Lane
Browse files

localbuf.c must be able to do blind writes.

parent 993b145d
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.46 2002/09/04 20:31:25 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.47 2002/12/05 22:48:03 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -90,19 +90,24 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr) ...@@ -90,19 +90,24 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
{ {
Relation bufrel = RelationNodeCacheGetRelation(bufHdr->tag.rnode); Relation bufrel = RelationNodeCacheGetRelation(bufHdr->tag.rnode);
/*
* The relcache is not supposed to throw away temp rels, so this
* should always succeed.
*/
Assert(bufrel != NULL);
/* flush this page */ /* flush this page */
smgrwrite(DEFAULT_SMGR, bufrel, bufHdr->tag.blockNum, if (bufrel == (Relation) NULL)
(char *) MAKE_PTR(bufHdr->data)); {
LocalBufferFlushCount++; smgrblindwrt(DEFAULT_SMGR,
bufHdr->tag.rnode,
bufHdr->tag.blockNum,
(char *) MAKE_PTR(bufHdr->data));
}
else
{
smgrwrite(DEFAULT_SMGR, bufrel,
bufHdr->tag.blockNum,
(char *) MAKE_PTR(bufHdr->data));
/* drop refcount incremented by RelationNodeCacheGetRelation */
RelationDecrementReferenceCount(bufrel);
}
/* drop refcount incremented by RelationNodeCacheGetRelation */ LocalBufferFlushCount++;
RelationDecrementReferenceCount(bufrel);
} }
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment