Skip to content

Commit cca705a

Browse files
committed
Fix bug in SetOffsetVacuumLimit() triggered by find_multixact_start() failure.
Previously, if find_multixact_start() failed, SetOffsetVacuumLimit() would install 0 into MultiXactState->offsetStopLimit if it previously succeeded. Luckily, there are no known cases where find_multixact_start() will return an error in 9.5 and above. But if it were to happen, for example due to filesystem permission issues, it'd be somewhat bad: GetNewMultiXactId() could continue allocating mxids even if close to a wraparound, or it could erroneously stop allocating mxids, even if no wraparound is looming. The wrong value would be corrected the next time SetOffsetVacuumLimit() is called, or by a restart. Reported-By: Noah Misch, although this is not his preferred fix Discussion: 20151210140450.GA22278@alap3.anarazel.de Backpatch: 9.5, where the bug was introduced as part of 4f627f
1 parent 2a35449 commit cca705a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/access/transam/multixact.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,6 +2552,7 @@ SetOffsetVacuumLimit(void)
25522552
bool oldestOffsetKnown = false;
25532553
bool prevOldestOffsetKnown;
25542554
MultiXactOffset offsetStopLimit = 0;
2555+
MultiXactOffset prevOffsetStopLimit;
25552556

25562557
/*
25572558
* NB: Have to prevent concurrent truncation, we might otherwise try to
@@ -2566,6 +2567,7 @@ SetOffsetVacuumLimit(void)
25662567
nextOffset = MultiXactState->nextOffset;
25672568
prevOldestOffsetKnown = MultiXactState->oldestOffsetKnown;
25682569
prevOldestOffset = MultiXactState->oldestOffset;
2570+
prevOffsetStopLimit = MultiXactState->offsetStopLimit;
25692571
Assert(MultiXactState->finishedStartup);
25702572
LWLockRelease(MultiXactGenLock);
25712573

@@ -2633,11 +2635,13 @@ SetOffsetVacuumLimit(void)
26332635
{
26342636
/*
26352637
* If we failed to get the oldest offset this time, but we have a
2636-
* value from a previous pass through this function, use the old value
2637-
* rather than automatically forcing it.
2638+
* value from a previous pass through this function, use the old
2639+
* values rather than automatically forcing an emergency autovacuum
2640+
* cycle again.
26382641
*/
26392642
oldestOffset = prevOldestOffset;
26402643
oldestOffsetKnown = true;
2644+
offsetStopLimit = prevOffsetStopLimit;
26412645
}
26422646

26432647
/* Install the computed values */

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