Create a "relation mapping" infrastructure to support changing the relfilenodes

Tom Lane <tgl@sss.pgh.pa.us>

Commit: b9b8831ad60f6e4bd580fe6dbe9749359298a3c4
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2010-02-07T20:48:13Z
Releases: 9.0.0
Create a "relation mapping" infrastructure to support changing the relfilenodes
of shared or nailed system catalogs.  This has two key benefits:

* The new CLUSTER-based VACUUM FULL can be applied safely to all catalogs.

* We no longer have to use an unsafe reindex-in-place approach for reindexing
  shared catalogs.

CLUSTER on nailed catalogs now works too, although I left it disabled on
shared catalogs because the resulting pg_index.indisclustered update would
only be visible in one database.

Since reindexing shared system catalogs is now fully transactional and
crash-safe, the former special cases in REINDEX behavior have been removed;
shared catalogs are treated the same as non-shared.

This commit does not do anything about the recently-discussed problem of
deadlocks between VACUUM FULL/CLUSTER on a system catalog and other
concurrent queries; will address that in a separate patch.  As a stopgap,
parallel_schedule has been tweaked to run vacuum.sql by itself, to avoid
such failures during the regression tests.

Files

PathChange+/−
contrib/oid2name/oid2name.c modified +11 −11
doc/src/sgml/catalogs.sgml modified +4 −2
doc/src/sgml/diskusage.sgml modified +15 −19
doc/src/sgml/func.sgml modified +63 −1
doc/src/sgml/pgbuffercache.sgml modified +3 −3
doc/src/sgml/ref/cluster.sgml modified +6 −6
doc/src/sgml/ref/reindex.sgml modified +10 −34
doc/src/sgml/storage.sgml modified +16 −1
src/backend/access/index/genam.c modified +3 −2
src/backend/access/transam/rmgr.c modified +3 −2
src/backend/access/transam/xact.c modified +31 −10
src/backend/access/transam/xlog.c modified +3 −1
src/backend/bootstrap/bootparse.y modified +22 −5
src/backend/bootstrap/bootstrap.c modified +8 −1
src/backend/catalog/catalog.c modified +4 −4
src/backend/catalog/heap.c modified +24 −27
src/backend/catalog/index.c modified +173 −71
src/backend/catalog/storage.c modified +51 −9
src/backend/catalog/toasting.c modified +7 −2
src/backend/commands/cluster.c modified +300 −134
src/backend/commands/indexcmds.c modified +9 −17
src/backend/commands/tablecmds.c modified +37 −45
src/backend/commands/vacuum.c modified +4 −5
src/backend/executor/execMain.c modified +2 −1
src/backend/parser/parse_clause.c modified +2 −2
src/backend/utils/adt/dbsize.c modified +121 −2
src/backend/utils/cache/catcache.c modified +42 −20
src/backend/utils/cache/inval.c modified +120 −13
src/backend/utils/cache/Makefile modified +2 −2
src/backend/utils/cache/relcache.c modified +116 −24
src/backend/utils/cache/relmapper.c added +913 −0
src/backend/utils/init/miscinit.c modified +1 −57
src/bin/pg_dump/pg_dump.c modified +7 −1
src/include/access/rmgr.h modified +2 −1
src/include/catalog/catalog.h modified +2 −3
src/include/catalog/catversion.h modified +2 −2
src/include/catalog/heap.h modified +7 −3
src/include/catalog/index.h modified +5 −2
src/include/catalog/pg_class.h modified +6 −5
src/include/catalog/pg_proc.h modified +5 −1
src/include/catalog/storage.h modified +2 −1
src/include/commands/cluster.h modified +5 −5
src/include/miscadmin.h modified +1 −5
src/include/storage/lwlock.h modified +2 −1
src/include/storage/relfilenode.h modified +5 −1
src/include/storage/sinval.h modified +42 −11
src/include/utils/builtins.h modified +3 −1
src/include/utils/catcache.h modified +2 −1
src/include/utils/inval.h modified +7 −1
src/include/utils/relcache.h modified +5 −2
src/include/utils/rel.h modified +11 −1
src/include/utils/relmapper.h added +62 −0
src/test/regress/expected/vacuum.out modified +1 −1
src/test/regress/parallel_schedule modified +5 −2