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

Commit ed16f73

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 86e4751 commit ed16f73

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/backend/access/transam/multixact.c

+12
Original file line numberDiff line numberDiff line change
@@ -2661,6 +2661,18 @@ SetOffsetVacuumLimit(bool finish_setup)
26612661
(errmsg("oldest MultiXactId member offset unknown")));
26622662
}
26632663

2664+
/*
2665+
* If we failed to get the oldest offset this time, but we have a value
2666+
* from a previous pass through this function, assess the need for
2667+
* autovacuum based on that old value rather than automatically forcing
2668+
* it.
2669+
*/
2670+
if (prevOldestOffsetKnown && !oldestOffsetKnown)
2671+
{
2672+
oldestOffset = prevOldestOffset;
2673+
oldestOffsetKnown = true;
2674+
}
2675+
26642676
/*
26652677
* Do we need an emergency autovacuum? If we're not sure, assume yes.
26662678
*/

0 commit comments

Comments
 (0)