diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2013-11-28 16:52:54 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2013-11-29 21:47:13 -0300 |
commit | f54106f77e6d71cbb3fa0924095e5142341fde2b (patch) | |
tree | cee909f9b7febc4d8cb40839f1bbf70b52f18d59 /src/backend/commands/cluster.c | |
parent | 76a31c689c627268067175b5d0687ce0dac9a4f4 (diff) | |
download | postgresql-f54106f77e6d71cbb3fa0924095e5142341fde2b.tar.gz postgresql-f54106f77e6d71cbb3fa0924095e5142341fde2b.zip |
Fix full-table-vacuum request mechanism for MultiXactIds
While autovacuum dutifully launched anti-multixact-wraparound vacuums
when the multixact "age" was reached, the vacuum code was not aware that
it needed to make them be full table vacuums. As the resulting
partial-table vacuums aren't capable of actually increasing relminmxid,
autovacuum continued to launch anti-wraparound vacuums that didn't have
the intended effect, until age of relfrozenxid caused the vacuum to
finally be a full table one via vacuum_freeze_table_age.
To fix, introduce logic for multixacts similar to that for plain
TransactionIds, using the same GUCs.
Backpatch to 9.3, where permanent MultiXactIds were introduced.
Andres Freund, some cleanup by Álvaro
Diffstat (limited to 'src/backend/commands/cluster.c')
-rw-r--r-- | src/backend/commands/cluster.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index afc6a786508..0b8ac8c8d8e 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -176,7 +176,10 @@ cluster(ClusterStmt *stmt, bool isTopLevel) /* close relation, keep lock till commit */ heap_close(rel, NoLock); - /* Do the job */ + /* + * Do the job. We use a -1 freeze_min_age to avoid having CLUSTER + * freeze tuples earlier than a plain VACUUM would. + */ cluster_rel(tableOid, indexOid, false, stmt->verbose, -1, -1); } else @@ -226,6 +229,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel) StartTransactionCommand(); /* functions in indexes may want a snapshot set */ PushActiveSnapshot(GetTransactionSnapshot()); + /* Do the job. As above, use a -1 freeze_min_age. */ cluster_rel(rvtc->tableOid, rvtc->indexOid, true, stmt->verbose, -1, -1); PopActiveSnapshot(); @@ -853,13 +857,12 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex, *pSwapToastByContent = false; /* - * compute xids used to freeze and weed out dead tuples. We use -1 - * freeze_min_age to avoid having CLUSTER freeze tuples earlier than a - * plain VACUUM would. + * compute xids used to freeze and weed out dead tuples. */ vacuum_set_xid_limits(freeze_min_age, freeze_table_age, OldHeap->rd_rel->relisshared, - &OldestXmin, &FreezeXid, NULL, &MultiXactCutoff); + &OldestXmin, &FreezeXid, NULL, &MultiXactCutoff, + NULL); /* * FreezeXid will become the table's new relfrozenxid, and that mustn't go |