diff options
| author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2008-09-30 10:52:14 +0000 |
|---|---|---|
| committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2008-09-30 10:52:14 +0000 |
| commit | 15c121b3ed7eb2f290e19533e41ccca734d23574 (patch) | |
| tree | b60226d720f87b82b5b44647e3d3031081cdfb07 /src/backend/utils | |
| parent | 2dbc0ca937f8ba9c76866a99fd04866232acea95 (diff) | |
| download | postgresql-15c121b3ed7eb2f290e19533e41ccca734d23574.tar.gz | |
Rewrite the FSM. Instead of relying on a fixed-size shared memory segment, the
free space information is stored in a dedicated FSM relation fork, with each
relation (except for hash indexes; they don't use FSM).
This eliminates the max_fsm_relations and max_fsm_pages GUC options; remove any
trace of them from the backend, initdb, and documentation.
Rewrite contrib/pg_freespacemap to match the new FSM implementation. Also
introduce a new variant of the get_raw_page(regclass, int4, int4) function in
contrib/pageinspect that let's you to return pages from any relation fork, and
a new fsm_page_contents() function to inspect the new FSM pages.
Diffstat (limited to 'src/backend/utils')
| -rw-r--r-- | src/backend/utils/cache/relcache.c | 10 | ||||
| -rw-r--r-- | src/backend/utils/misc/guc.c | 22 | ||||
| -rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 7 |
3 files changed, 9 insertions, 30 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 7bfb23aaf0..cec75ada72 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.273 2008/08/10 19:02:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.274 2008/09/30 10:52:13 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -304,6 +304,7 @@ AllocateRelationDesc(Relation relation, Form_pg_class relp) */ MemSet(relation, 0, sizeof(RelationData)); relation->rd_targblock = InvalidBlockNumber; + relation->rd_fsm_nblocks_cache = InvalidBlockNumber; /* make sure relation is marked as having no open file yet */ relation->rd_smgr = NULL; @@ -1364,6 +1365,7 @@ formrdesc(const char *relationName, Oid relationReltype, */ relation = (Relation) palloc0(sizeof(RelationData)); relation->rd_targblock = InvalidBlockNumber; + relation->rd_fsm_nblocks_cache = InvalidBlockNumber; /* make sure relation is marked as having no open file yet */ relation->rd_smgr = NULL; @@ -1652,8 +1654,9 @@ RelationReloadIndexInfo(Relation relation) heap_freetuple(pg_class_tuple); /* We must recalculate physical address in case it changed */ RelationInitPhysicalAddr(relation); - /* Make sure targblock is reset in case rel was truncated */ + /* Must reset targblock and fsm_nblocks_cache in case rel was truncated */ relation->rd_targblock = InvalidBlockNumber; + relation->rd_fsm_nblocks_cache = InvalidBlockNumber; /* Must free any AM cached data, too */ if (relation->rd_amcache) pfree(relation->rd_amcache); @@ -1736,6 +1739,7 @@ RelationClearRelation(Relation relation, bool rebuild) if (relation->rd_isnailed) { relation->rd_targblock = InvalidBlockNumber; + relation->rd_fsm_nblocks_cache = InvalidBlockNumber; if (relation->rd_rel->relkind == RELKIND_INDEX) { relation->rd_isvalid = false; /* needs to be revalidated */ @@ -2330,6 +2334,7 @@ RelationBuildLocalRelation(const char *relname, rel = (Relation) palloc0(sizeof(RelationData)); rel->rd_targblock = InvalidBlockNumber; + rel->rd_fsm_nblocks_cache = InvalidBlockNumber; /* make sure relation is marked as having no open file yet */ rel->rd_smgr = NULL; @@ -3586,6 +3591,7 @@ load_relcache_init_file(void) */ rel->rd_smgr = NULL; rel->rd_targblock = InvalidBlockNumber; + rel->rd_fsm_nblocks_cache = InvalidBlockNumber; if (rel->rd_isnailed) rel->rd_refcnt = 1; else diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index f0f49538e7..93f20eef35 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.473 2008/09/23 21:12:03 mha Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.474 2008/09/30 10:52:13 heikki Exp $ * *-------------------------------------------------------------------- */ @@ -57,7 +57,6 @@ #include "regex/regex.h" #include "storage/bufmgr.h" #include "storage/fd.h" -#include "storage/freespace.h" #include "tcop/tcopprot.h" #include "tsearch/ts_cache.h" #include "utils/builtins.h" @@ -446,8 +445,6 @@ const char *const config_group_names[] = gettext_noop("Resource Usage"), /* RESOURCES_MEM */ gettext_noop("Resource Usage / Memory"), - /* RESOURCES_FSM */ - gettext_noop("Resource Usage / Free Space Map"), /* RESOURCES_KERNEL */ gettext_noop("Resource Usage / Kernel Resources"), /* WAL */ @@ -1529,23 +1526,6 @@ static struct config_int ConfigureNamesInt[] = }, { - {"max_fsm_relations", PGC_POSTMASTER, RESOURCES_FSM, - gettext_noop("Sets the maximum number of tables and indexes for which free space is tracked."), - NULL - }, - &MaxFSMRelations, - 1000, 100, INT_MAX, NULL, NULL - }, - { - {"max_fsm_pages", PGC_POSTMASTER, RESOURCES_FSM, - gettext_noop("Sets the maximum number of disk pages for which free space is tracked."), - NULL - }, - &MaxFSMPages, - 20000, 1000, INT_MAX, NULL, NULL - }, - - { {"max_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT, gettext_noop("Sets the maximum number of locks per transaction."), gettext_noop("The shared lock table is sized on the assumption that " diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 342be9d6c3..56afb2e488 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -114,13 +114,6 @@ #maintenance_work_mem = 16MB # min 1MB #max_stack_depth = 2MB # min 100kB -# - Free Space Map - - -#max_fsm_pages = 204800 # min max_fsm_relations*16, 6 bytes each - # (change requires restart) -#max_fsm_relations = 1000 # min 100, ~70 bytes each - # (change requires restart) - # - Kernel Resource Usage - #max_files_per_process = 1000 # min 25 |
