mirror of
https://github.com/postgres/postgres.git
synced 2025-08-15 14:02:29 +03:00
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
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user