pgsql: Restructure CLUSTER/newstyle VACUUM FULL/ALTER TABLE support so

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Restructure CLUSTER/newstyle VACUUM FULL/ALTER TABLE support so
Date: 2010-02-04 00:09:14
Message-ID: 20100204000914.6B5E27541B9@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
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.

Modified Files:
--------------
pgsql/src/backend/access/heap:
tuptoaster.c (r1.96 -> r1.97)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/heap/tuptoaster.c?r1=1.96&r2=1.97)
pgsql/src/backend/commands:
cluster.c (r1.196 -> r1.197)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/cluster.c?r1=1.196&r2=1.197)
tablecmds.c (r1.323 -> r1.324)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c?r1=1.323&r2=1.324)
pgsql/src/backend/utils/cache:
relcache.c (r1.301 -> r1.302)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/relcache.c?r1=1.301&r2=1.302)
pgsql/src/include/commands:
cluster.h (r1.38 -> r1.39)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/commands/cluster.h?r1=1.38&r2=1.39)
pgsql/src/include/utils:
rel.h (r1.120 -> r1.121)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/rel.h?r1=1.120&r2=1.121)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2010-02-04 00:14:57 Re: pgsql: Check to ensure the number of primary key fields supplied does
Previous Message Joe Conway 2010-02-03 23:02:39 pgsql: Check to ensure the number of primary key fields supplied does