OSDN Git Service

Create a "relation mapping" infrastructure to support changing the relfilenodes
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 7 Feb 2010 20:48:13 +0000 (20:48 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 7 Feb 2010 20:48:13 +0000 (20:48 +0000)
commitb9b8831ad60f6e4bd580fe6dbe9749359298a3c4
treeaf6948498f13a43edd982b05808ed89b5b8191ab
parent7fc30c488fc6e9674564206193c29b1a657a818f
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.
54 files changed:
contrib/oid2name/oid2name.c
doc/src/sgml/catalogs.sgml
doc/src/sgml/diskusage.sgml
doc/src/sgml/func.sgml
doc/src/sgml/pgbuffercache.sgml
doc/src/sgml/ref/cluster.sgml
doc/src/sgml/ref/reindex.sgml
doc/src/sgml/storage.sgml
src/backend/access/index/genam.c
src/backend/access/transam/rmgr.c
src/backend/access/transam/xact.c
src/backend/access/transam/xlog.c
src/backend/bootstrap/bootparse.y
src/backend/bootstrap/bootstrap.c
src/backend/catalog/catalog.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/storage.c
src/backend/catalog/toasting.c
src/backend/commands/cluster.c
src/backend/commands/indexcmds.c
src/backend/commands/tablecmds.c
src/backend/commands/vacuum.c
src/backend/executor/execMain.c
src/backend/parser/parse_clause.c
src/backend/utils/adt/dbsize.c
src/backend/utils/cache/Makefile
src/backend/utils/cache/catcache.c
src/backend/utils/cache/inval.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/relmapper.c [new file with mode: 0644]
src/backend/utils/init/miscinit.c
src/bin/pg_dump/pg_dump.c
src/include/access/rmgr.h
src/include/catalog/catalog.h
src/include/catalog/catversion.h
src/include/catalog/heap.h
src/include/catalog/index.h
src/include/catalog/pg_class.h
src/include/catalog/pg_proc.h
src/include/catalog/storage.h
src/include/commands/cluster.h
src/include/miscadmin.h
src/include/storage/lwlock.h
src/include/storage/relfilenode.h
src/include/storage/sinval.h
src/include/utils/builtins.h
src/include/utils/catcache.h
src/include/utils/inval.h
src/include/utils/rel.h
src/include/utils/relcache.h
src/include/utils/relmapper.h [new file with mode: 0644]
src/test/regress/expected/vacuum.out
src/test/regress/parallel_schedule