aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/freespace/indexfsm.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/freespace/indexfsm.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/freespace/indexfsm.c')
-rw-r--r--src/backend/storage/freespace/indexfsm.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/backend/storage/freespace/indexfsm.c b/src/backend/storage/freespace/indexfsm.c
index 768b633f081..58d8e6caf2e 100644
--- a/src/backend/storage/freespace/indexfsm.c
+++ b/src/backend/storage/freespace/indexfsm.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/freespace/indexfsm.c,v 1.2 2008/10/06 08:04:11 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/freespace/indexfsm.c,v 1.3 2008/11/19 10:34:52 heikki Exp $
*
*
* NOTES:
@@ -31,20 +31,6 @@
*/
/*
- * InitIndexFreeSpaceMap - Create or reset the FSM fork for relation.
- */
-void
-InitIndexFreeSpaceMap(Relation rel)
-{
- /* Create FSM fork if it doesn't exist yet, or truncate it if it does */
- RelationOpenSmgr(rel);
- if (!smgrexists(rel->rd_smgr, FSM_FORKNUM))
- smgrcreate(rel->rd_smgr, FSM_FORKNUM, rel->rd_istemp, false);
- else
- smgrtruncate(rel->rd_smgr, FSM_FORKNUM, 0, rel->rd_istemp);
-}
-
-/*
* GetFreeIndexPage - return a free page from the FSM
*
* As a side effect, the page is marked as used in the FSM.
@@ -80,18 +66,6 @@ RecordUsedIndexPage(Relation rel, BlockNumber usedBlock)
}
/*
- * IndexFreeSpaceMapTruncate - adjust for truncation of a relation.
- *
- * We need to delete any stored data past the new relation length, so that
- * we don't bogusly return removed block numbers.
- */
-void
-IndexFreeSpaceMapTruncate(Relation rel, BlockNumber nblocks)
-{
- FreeSpaceMapTruncateRel(rel, nblocks);
-}
-
-/*
* IndexFreeSpaceMapVacuum - scan and fix any inconsistencies in the FSM
*/
void