diff options
-rw-r--r-- | src/backend/access/gin/ginvacuum.c | 5 | ||||
-rw-r--r-- | src/backend/access/gist/gistvacuum.c | 5 | ||||
-rw-r--r-- | src/backend/access/nbtree/nbtree.c | 5 | ||||
-rw-r--r-- | src/backend/storage/freespace/indexfsm.c | 11 | ||||
-rw-r--r-- | src/include/storage/indexfsm.h | 6 |
5 files changed, 25 insertions, 7 deletions
diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c index c3e6f4e6f2d..733710ef563 100644 --- a/src/backend/access/gin/ginvacuum.c +++ b/src/backend/access/gin/ginvacuum.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.22 2008/09/30 10:52:10 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.23 2008/10/06 08:04:11 heikki Exp $ *------------------------------------------------------------------------- */ @@ -744,6 +744,9 @@ ginvacuumcleanup(PG_FUNCTION_ARGS) totFreePages = totFreePages - stats->pages_removed; } + /* Finally, vacuum the FSM */ + IndexFreeSpaceMapVacuum(info->index); + stats->pages_free = totFreePages; if (needLock) diff --git a/src/backend/access/gist/gistvacuum.c b/src/backend/access/gist/gistvacuum.c index b545922ccc8..2a917b6528a 100644 --- a/src/backend/access/gist/gistvacuum.c +++ b/src/backend/access/gist/gistvacuum.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.37 2008/09/30 10:52:10 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.38 2008/10/06 08:04:11 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -619,6 +619,9 @@ gistvacuumcleanup(PG_FUNCTION_ARGS) totFreePages = totFreePages - stats->std.pages_removed; } + /* Finally, vacuum the FSM */ + IndexFreeSpaceMapVacuum(info->index); + /* return statistics */ stats->std.pages_free = totFreePages; if (needLock) diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index abb6bd5c5d4..76f6a472aef 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -12,7 +12,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.162 2008/09/30 10:52:10 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.163 2008/10/06 08:04:11 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -574,6 +574,9 @@ btvacuumcleanup(PG_FUNCTION_ARGS) btvacuumscan(info, stats, NULL, NULL, 0); } + /* Finally, vacuum the FSM */ + IndexFreeSpaceMapVacuum(info->index); + /* * During a non-FULL vacuum it's quite possible for us to be fooled by * concurrent page splits into double-counting some index tuples, so diff --git a/src/backend/storage/freespace/indexfsm.c b/src/backend/storage/freespace/indexfsm.c index 62fd3d37942..768b633f081 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.1 2008/09/30 10:52:13 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/storage/freespace/indexfsm.c,v 1.2 2008/10/06 08:04:11 heikki Exp $ * * * NOTES: @@ -90,3 +90,12 @@ IndexFreeSpaceMapTruncate(Relation rel, BlockNumber nblocks) { FreeSpaceMapTruncateRel(rel, nblocks); } + +/* + * IndexFreeSpaceMapVacuum - scan and fix any inconsistencies in the FSM + */ +void +IndexFreeSpaceMapVacuum(Relation rel) +{ + FreeSpaceMapVacuum(rel); +} diff --git a/src/include/storage/indexfsm.h b/src/include/storage/indexfsm.h index 76bb26f7bc8..36872076f87 100644 --- a/src/include/storage/indexfsm.h +++ b/src/include/storage/indexfsm.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/indexfsm.h,v 1.1 2008/09/30 10:52:14 heikki Exp $ + * $PostgreSQL: pgsql/src/include/storage/indexfsm.h,v 1.2 2008/10/06 08:04:11 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -16,12 +16,12 @@ #include "utils/rel.h" -extern void InitIndexFreeSpaceMap(Relation rel); - extern BlockNumber GetFreeIndexPage(Relation rel); extern void RecordFreeIndexPage(Relation rel, BlockNumber page); extern void RecordUsedIndexPage(Relation rel, BlockNumber page); +extern void InitIndexFreeSpaceMap(Relation rel); extern void IndexFreeSpaceMapTruncate(Relation rel, BlockNumber nblocks); +extern void IndexFreeSpaceMapVacuum(Relation rel); #endif /* INDEXFSM_H */ |