@@ -893,6 +893,7 @@ vacuum_set_xid_limits(Relation rel,
893
893
int effective_multixact_freeze_max_age ;
894
894
TransactionId limit ;
895
895
TransactionId safeLimit ;
896
+ MultiXactId oldestMxact ;
896
897
MultiXactId mxactLimit ;
897
898
MultiXactId safeMxactLimit ;
898
899
@@ -970,7 +971,8 @@ vacuum_set_xid_limits(Relation rel,
970
971
Assert (mxid_freezemin >= 0 );
971
972
972
973
/* compute the cutoff multi, being careful to generate a valid value */
973
- mxactLimit = GetOldestMultiXactId () - mxid_freezemin ;
974
+ oldestMxact = GetOldestMultiXactId ();
975
+ mxactLimit = oldestMxact - mxid_freezemin ;
974
976
if (mxactLimit < FirstMultiXactId )
975
977
mxactLimit = FirstMultiXactId ;
976
978
@@ -984,7 +986,11 @@ vacuum_set_xid_limits(Relation rel,
984
986
ereport (WARNING ,
985
987
(errmsg ("oldest multixact is far in the past" ),
986
988
errhint ("Close open transactions with multixacts soon to avoid wraparound problems." )));
987
- mxactLimit = safeMxactLimit ;
989
+ /* Use the safe limit, unless an older mxact is still running */
990
+ if (MultiXactIdPrecedes (oldestMxact , safeMxactLimit ))
991
+ mxactLimit = oldestMxact ;
992
+ else
993
+ mxactLimit = safeMxactLimit ;
988
994
}
989
995
990
996
* multiXactCutoff = mxactLimit ;
0 commit comments