aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-12-05 22:48:10 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-12-05 22:48:10 +0000
commit500677c40fab730eaf6940b2f1ddd6152b3dfc29 (patch)
tree9de1a261e8844434430ebd8f1537b3758f416af4
parent0e98ae22d3d49e6fbf53f9d7f8a6806f5d27d09a (diff)
downloadpostgresql-500677c40fab730eaf6940b2f1ddd6152b3dfc29.tar.gz
postgresql-500677c40fab730eaf6940b2f1ddd6152b3dfc29.zip
localbuf.c must be able to do blind writes.
-rw-r--r--src/backend/storage/buffer/localbuf.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index 5f4033b583e..8e439c04ce6 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -9,7 +9,7 @@
*
*
* 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.46.2.1 2002/12/05 22:48:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -90,19 +90,24 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
{
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 */
- smgrwrite(DEFAULT_SMGR, bufrel, bufHdr->tag.blockNum,
- (char *) MAKE_PTR(bufHdr->data));
- LocalBufferFlushCount++;
+ if (bufrel == (Relation) NULL)
+ {
+ 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 */
- RelationDecrementReferenceCount(bufrel);
+ LocalBufferFlushCount++;
}
/*