aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer/bufmgr.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2008-11-19 10:34:52 +0000
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2008-11-19 10:34:52 +0000
commit3396000684b41e7e9467d1abc67152b39e697035 (patch)
treec8edf238f89cd7b0b1562b919f2addebc67eb54e /src/backend/storage/buffer/bufmgr.c
parent26e6c896c946bc1a9e9f608b2c7463be1e8c6291 (diff)
downloadpostgresql-3396000684b41e7e9467d1abc67152b39e697035.tar.gz
postgresql-3396000684b41e7e9467d1abc67152b39e697035.zip
Rethink the way FSM truncation works. Instead of WAL-logging FSM
truncations in FSM code, call FreeSpaceMapTruncateRel from smgr_redo. To make that cleaner from modularity point of view, move the WAL-logging one level up to RelationTruncate, and move RelationTruncate and all the related WAL-logging to new src/backend/catalog/storage.c file. Introduce new RelationCreateStorage and RelationDropStorage functions that are used instead of calling smgrcreate/smgrscheduleunlink directly. Move the pending rel deletion stuff from smgrcreate/smgrscheduleunlink to the new functions. This leaves smgr.c as a thin wrapper around md.c; all the transactional stuff is now in storage.c. This will make it easier to add new forks with similar truncation logic, like the visibility map.
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r--src/backend/storage/buffer/bufmgr.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index bb4b968f1c4..b7e0861e2b5 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.241 2008/11/11 13:19:16 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.242 2008/11/19 10:34:52 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1695,8 +1695,6 @@ void
BufmgrCommit(void)
{
/* Nothing to do in bufmgr anymore... */
-
- smgrcommit();
}
/*
@@ -1848,26 +1846,6 @@ RelationGetNumberOfBlocks(Relation relation)
return smgrnblocks(relation->rd_smgr, MAIN_FORKNUM);
}
-/*
- * RelationTruncate
- * Physically truncate a relation to the specified number of blocks.
- *
- * As of Postgres 8.1, this includes getting rid of any buffers for the
- * blocks that are to be dropped; previously, callers had to do that.
- */
-void
-RelationTruncate(Relation rel, BlockNumber nblocks)
-{
- /* Open it at the smgr level if not already done */
- RelationOpenSmgr(rel);
-
- /* Make sure rd_targblock isn't pointing somewhere past end */
- rel->rd_targblock = InvalidBlockNumber;
-
- /* Do the real work */
- smgrtruncate(rel->rd_smgr, MAIN_FORKNUM, nblocks, rel->rd_istemp);
-}
-
/* ---------------------------------------------------------------------
* DropRelFileNodeBuffers
*