mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Have CLUSTER advance the table's relfrozenxid. The new frozen point is the
FreezeXid introduced in a recent commit, so there isn't any data loss in this approach. Doing it causes ALTER TABLE (or rather, the forms of it that cause a full table rewrite) to be affected as well. In this case, the frozen point is RecentXmin, because after the rewrite all the tuples are relabeled with the rewriting transaction's Xid. TOAST tables are fixed automatically as well, as fallout of the way they were already being handled in the respective code paths. With this patch, there is no longer need to VACUUM tables for Xid wraparound purposes that have been cleaned up via TRUNCATE or CLUSTER.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.224 2007/05/16 17:28:20 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.225 2007/05/18 23:19:41 alvherre Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2285,8 +2285,13 @@ ATRewriteTables(List **wqueue)
|
||||
*/
|
||||
ATRewriteTable(tab, OIDNewHeap);
|
||||
|
||||
/* Swap the physical files of the old and new heaps. */
|
||||
swap_relation_files(tab->relid, OIDNewHeap);
|
||||
/*
|
||||
* Swap the physical files of the old and new heaps. Since we are
|
||||
* generating a new heap, we can use RecentXmin for the table's new
|
||||
* relfrozenxid because we rewrote all the tuples on
|
||||
* ATRewriteTable, so no older Xid remains on the table.
|
||||
*/
|
||||
swap_relation_files(tab->relid, OIDNewHeap, RecentXmin);
|
||||
|
||||
CommandCounterIncrement();
|
||||
|
||||
|
Reference in New Issue
Block a user