]> granicus.if.org Git - postgresql/commit
Restructure CLUSTER/newstyle VACUUM FULL/ALTER TABLE support so that swapping
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 4 Feb 2010 00:09:14 +0000 (00:09 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 4 Feb 2010 00:09:14 +0000 (00:09 +0000)
commit9727c583fe863252338dc4c5a925d78c59128c93
treea5cc318744cccb7cb60565b2e0b11f7997cfde15
parentfdac8cf998b9a41fa2b64cb3a80bc02548189082
Restructure CLUSTER/newstyle VACUUM FULL/ALTER TABLE support so that swapping
of old and new toast tables can be done either at the logical level (by
swapping the heaps' reltoastrelid links) or at the physical level (by swapping
the relfilenodes of the toast tables and their indexes).  This is necessary
infrastructure for upcoming changes to support CLUSTER/VAC FULL on shared
system catalogs, where we cannot change reltoastrelid.  The physical swap
saves a few catalog updates too.

We unfortunately have to keep the logical-level swap logic because in some
cases we will be adding or deleting a toast table, so there's no possibility
of a physical swap.  However, that only happens as a consequence of schema
changes in the table, which we do not need to support for system catalogs,
so such cases aren't an obstacle for that.

In passing, refactor the cluster support functions a little bit to eliminate
unnecessarily-duplicated code; and fix the problem that while CLUSTER had
been taught to rename the final toast table at need, ALTER TABLE had not.
src/backend/access/heap/tuptoaster.c
src/backend/commands/cluster.c
src/backend/commands/tablecmds.c
src/backend/utils/cache/relcache.c
src/include/commands/cluster.h
src/include/utils/rel.h