* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.115 2004/05/08 19:09:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.116 2004/05/31 19:24:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
if (new_pages != num_pages)
{
- int i;
-
/*
* Okay to truncate.
*
* blocks we aren't deleting, but it's the closest thing in
* bufmgr's API.
*/
- i = FlushRelationBuffers(rel, new_pages);
- if (i < 0)
- elog(ERROR, "FlushRelationBuffers returned %d", i);
+ FlushRelationBuffers(rel, new_pages);
/*
* Do the physical truncation.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.265 2004/05/26 04:41:07 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.266 2004/05/31 19:24:05 tgl Exp $
*
*
* INTERFACE ROUTINES
heap_drop_with_catalog(Oid rid)
{
Relation rel;
- int i;
/*
* Open and lock the relation.
* Release all buffers that belong to this relation, after writing any
* that are dirty
*/
- i = FlushRelationBuffers(rel, (BlockNumber) 0);
- if (i < 0)
- elog(ERROR, "FlushRelationBuffers returned %d", i);
+ FlushRelationBuffers(rel, (BlockNumber) 0);
/*
* remove inheritance information
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.232 2004/05/26 04:41:07 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.233 2004/05/31 19:24:05 tgl Exp $
*
*
* INTERFACE ROUTINES
Relation indexRelation;
HeapTuple tuple;
bool hasexprs;
- int i;
Assert(OidIsValid(indexId));
/*
* flush buffer cache and physically remove the file
*/
- i = FlushRelationBuffers(userIndexRelation, (BlockNumber) 0);
- if (i < 0)
- elog(ERROR, "FlushRelationBuffers returned %d", i);
+ FlushRelationBuffers(userIndexRelation, (BlockNumber) 0);
if (userIndexRelation->rd_smgr == NULL)
userIndexRelation->rd_smgr = smgropen(userIndexRelation->rd_node);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.124 2004/05/26 04:41:10 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.125 2004/05/31 19:24:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
Form_pg_class relform1,
relform2;
Oid swaptemp;
- int i;
CatalogIndexState indstate;
/* We need writable copies of both pg_class tuples. */
* forget about'em. (XXX this might not be necessary anymore?)
*/
rel = relation_open(r1, NoLock);
- i = FlushRelationBuffers(rel, 0);
- if (i < 0)
- elog(ERROR, "FlushRelationBuffers returned %d", i);
+ FlushRelationBuffers(rel, 0);
relation_close(rel, NoLock);
rel = relation_open(r2, NoLock);
- i = FlushRelationBuffers(rel, 0);
- if (i < 0)
- elog(ERROR, "FlushRelationBuffers returned %d", i);
+ FlushRelationBuffers(rel, 0);
relation_close(rel, NoLock);
/*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.278 2004/05/26 04:41:12 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.279 2004/05/31 19:24:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* tuples have correct on-row commit status on disk (see
* bufmgr.c's comments for FlushRelationBuffers()).
*/
- i = FlushRelationBuffers(onerel, vacrelstats->rel_pages);
- if (i < 0)
- elog(ERROR, "FlushRelationBuffers returned %d", i);
+ FlushRelationBuffers(onerel, vacrelstats->rel_pages);
}
}
* tuples have correct on-row commit status on disk (see bufmgr.c's
* comments for FlushRelationBuffers()).
*/
- i = FlushRelationBuffers(onerel, blkno);
- if (i < 0)
- elog(ERROR, "FlushRelationBuffers returned %d", i);
+ FlushRelationBuffers(onerel, blkno);
/* truncate relation, if needed */
if (blkno < nblocks)
Assert(vacrelstats->rel_pages >= vacuum_pages->empty_end_pages);
relblocks = vacrelstats->rel_pages - vacuum_pages->empty_end_pages;
- i = FlushRelationBuffers(onerel, relblocks);
- if (i < 0)
- elog(ERROR, "FlushRelationBuffers returned %d", i);
+ FlushRelationBuffers(onerel, relblocks);
/* truncate relation if there are some empty end-pages */
if (vacuum_pages->empty_end_pages > 0)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.40 2004/05/08 19:09:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.41 2004/05/31 19:24:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* will also write out dirty buffers for blocks we aren't deleting,
* but it's the closest thing in bufmgr's API.
*/
- i = FlushRelationBuffers(onerel, new_rel_pages);
- if (i < 0)
- elog(ERROR, "FlushRelationBuffers returned %d", i);
+ FlushRelationBuffers(onerel, new_rel_pages);
/*
* Do the physical truncation.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.167 2004/05/31 03:48:02 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.168 2004/05/31 19:24:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*
* This function writes all dirty pages of a relation out to disk.
* Furthermore, pages that have blocknumber >= firstDelBlock are
- * actually removed from the buffer pool. An error code is returned
- * if we fail to dump a dirty buffer or if we find one of
- * the target pages is pinned into the cache.
+ * actually removed from the buffer pool.
*
* This is called by DROP TABLE to clear buffers for the relation
* from the buffer pool. Note that we must write dirty buffers,
* to still be present in the cache due to failure of an earlier
* transaction. So, must flush dirty buffers without complaint.
*
- * Returns: 0 - Ok, -1 - FAILED TO CLEAR DIRTY BIT, -2 - PINNED
- *
* XXX currently it sequentially searches the buffer pool, should be
* changed to more clever ways of searching.
* --------------------------------------------------------------------
*/
-int
+void
FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock)
{
int i;
error_context_stack = errcontext.previous;
}
if (LocalRefCount[i] > 0)
- {
- elog(WARNING, "FlushRelationBuffers(\"%s\" (local), %u): block %u is referenced (%d)",
+ elog(ERROR, "FlushRelationBuffers(\"%s\" (local), %u): block %u is referenced (%d)",
RelationGetRelationName(rel), firstDelBlock,
bufHdr->tag.blockNum, LocalRefCount[i]);
- return (-2);
- }
if (bufHdr->tag.blockNum >= firstDelBlock)
bufHdr->tag.rnode.relNode = InvalidOid;
}
}
- return 0;
+ return;
}
LWLockAcquire(BufMgrLock, LW_EXCLUSIVE);
}
UnpinBuffer(bufHdr);
if (bufHdr->flags & BM_DIRTY || bufHdr->cntxDirty)
- {
- LWLockRelease(BufMgrLock);
- elog(WARNING, "FlushRelationBuffers(\"%s\", %u): block %u was re-dirtied",
+ elog(ERROR, "FlushRelationBuffers(\"%s\", %u): block %u was re-dirtied",
RelationGetRelationName(rel), firstDelBlock,
bufHdr->tag.blockNum);
- return -1;
- }
}
if (bufHdr->refcount != 0)
- {
- LWLockRelease(BufMgrLock);
- elog(WARNING, "FlushRelationBuffers(\"%s\", %u): block %u is referenced (private %d, global %u)",
+ elog(ERROR, "FlushRelationBuffers(\"%s\", %u): block %u is referenced (private %d, global %u)",
RelationGetRelationName(rel), firstDelBlock,
bufHdr->tag.blockNum,
PrivateRefCount[i], bufHdr->refcount);
- return -2;
- }
if (bufHdr->tag.blockNum >= firstDelBlock)
StrategyInvalidateBuffer(bufHdr);
}
}
LWLockRelease(BufMgrLock);
-
- return 0;
}
/*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.81 2004/05/31 03:48:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/storage/bufmgr.h,v 1.82 2004/05/31 19:24:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
extern BlockNumber BufferGetBlockNumber(Buffer buffer);
extern BlockNumber RelationGetNumberOfBlocks(Relation relation);
extern void RelationTruncate(Relation rel, BlockNumber nblocks);
-extern int FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock);
+extern void FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock);
extern void DropRelationBuffers(Relation rel);
extern void DropRelFileNodeBuffers(RelFileNode rnode, bool istemp,
BlockNumber firstDelBlock);