Skip to content

Commit 76a31c6

Browse files
committed
Replace hardcoded 200000000 with autovacuum_freeze_max_age
Parts of the code used autovacuum_freeze_max_age to determine whether anti-multixact-wraparound vacuums are necessary, while others used a hardcoded 200000000 value. This leads to problems when autovacuum_freeze_max_age is set to a non-default value. Use the latter everywhere. Backpatch to 9.3, where vacuuming of multixacts was introduced. Andres Freund
1 parent 79193c7 commit 76a31c6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/backend/access/transam/multixact.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include "funcapi.h"
7575
#include "miscadmin.h"
7676
#include "pg_trace.h"
77+
#include "postmaster/autovacuum.h"
7778
#include "storage/lmgr.h"
7879
#include "storage/pmsignal.h"
7980
#include "storage/procarray.h"
@@ -1958,6 +1959,10 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid)
19581959
/*
19591960
* We'll refuse to continue assigning MultiXactIds once we get within 100
19601961
* multi of data loss.
1962+
*
1963+
* Note: This differs from the magic number used in
1964+
* SetTransactionIdLimit() since vacuum itself will never generate new
1965+
* multis.
19611966
*/
19621967
multiStopLimit = multiWrapLimit - 100;
19631968
if (multiStopLimit < FirstMultiXactId)
@@ -1979,9 +1984,12 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid)
19791984

19801985
/*
19811986
* We'll start trying to force autovacuums when oldest_datminmxid gets to
1982-
* be more than 200 million transactions old.
1987+
* be more than autovacuum_freeze_max_age mxids old.
1988+
*
1989+
* It's a bit ugly to just reuse limits for xids that way, but it doesn't
1990+
* seem worth adding separate GUCs for that purpose.
19831991
*/
1984-
multiVacLimit = oldest_datminmxid + 200000000;
1992+
multiVacLimit = oldest_datminmxid + autovacuum_freeze_max_age;
19851993
if (multiVacLimit < FirstMultiXactId)
19861994
multiVacLimit += FirstMultiXactId;
19871995

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy