Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6199b1f

Browse files
committed
Fix corner case in autovacuum-forcing logic for multixact wraparound.
Since find_multixact_start() relies on SimpleLruDoesPhysicalPageExist(), and that function looks only at the on-disk state, it's possible for it to fail to find a page that exists in the in-memory SLRU that has not been written yet. If that happens, SetOffsetVacuumLimit() will erroneously decide to force emergency autovacuuming immediately. We should probably fix find_multixact_start() to consider the data cached in memory as well as on the on-disk state, but that's no excuse for SetOffsetVacuumLimit() to be stupid about the case where it can no longer read the value after having previously succeeded in doing so. Report by Andres Freund.
1 parent 4130b2c commit 6199b1f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/backend/access/transam/multixact.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,6 +2680,18 @@ SetOffsetVacuumLimit(bool finish_setup)
26802680
(errmsg("oldest MultiXactId member offset unknown")));
26812681
}
26822682

2683+
/*
2684+
* If we failed to get the oldest offset this time, but we have a value
2685+
* from a previous pass through this function, assess the need for
2686+
* autovacuum based on that old value rather than automatically forcing
2687+
* it.
2688+
*/
2689+
if (prevOldestOffsetKnown && !oldestOffsetKnown)
2690+
{
2691+
oldestOffset = prevOldestOffset;
2692+
oldestOffsetKnown = true;
2693+
}
2694+
26832695
/*
26842696
* Do we need an emergency autovacuum? If we're not sure, assume yes.
26852697
*/

0 commit comments

Comments
 (0)