diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2013-11-28 16:45:29 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2013-11-29 21:48:08 -0300 |
commit | d9484ab5f3cbcfea64536fec333723f9aa4c0b2c (patch) | |
tree | 9d1ebb4f3c53725500990dd76bb16b5131162050 | |
parent | a9380b5c333043fc1ffc342475b3b1f2c021e962 (diff) | |
download | postgresql-d9484ab5f3cbcfea64536fec333723f9aa4c0b2c.tar.gz postgresql-d9484ab5f3cbcfea64536fec333723f9aa4c0b2c.zip |
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
-rw-r--r-- | src/backend/access/transam/multixact.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index e3f5cbc0cd9..de0193aaf64 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -74,6 +74,7 @@ #include "funcapi.h" #include "miscadmin.h" #include "pg_trace.h" +#include "postmaster/autovacuum.h" #include "storage/lmgr.h" #include "storage/pmsignal.h" #include "storage/procarray.h" @@ -1958,6 +1959,10 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid) /* * We'll refuse to continue assigning MultiXactIds once we get within 100 * multi of data loss. + * + * Note: This differs from the magic number used in + * SetTransactionIdLimit() since vacuum itself will never generate new + * multis. */ multiStopLimit = multiWrapLimit - 100; if (multiStopLimit < FirstMultiXactId) @@ -1979,9 +1984,12 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid) /* * We'll start trying to force autovacuums when oldest_datminmxid gets to - * be more than 200 million transactions old. + * be more than autovacuum_freeze_max_age mxids old. + * + * It's a bit ugly to just reuse limits for xids that way, but it doesn't + * seem worth adding separate GUCs for that purpose. */ - multiVacLimit = oldest_datminmxid + 200000000; + multiVacLimit = oldest_datminmxid + autovacuum_freeze_max_age; if (multiVacLimit < FirstMultiXactId) multiVacLimit += FirstMultiXactId; |