@@ -483,9 +483,11 @@ vacuum_set_xid_limits(Relation rel,
483
483
int mxid_freezemin ;
484
484
int effective_multixact_freeze_max_age ;
485
485
TransactionId limit ;
486
- TransactionId safeLimit , nextXid ;
486
+ TransactionId safeLimit ;
487
+ TransactionId nextXid ;
487
488
MultiXactId mxactLimit ;
488
489
MultiXactId safeMxactLimit ;
490
+ MultiXactId nextMxactId ;
489
491
490
492
/*
491
493
* We can always ignore processes running lazy vacuum. This is because we
@@ -562,13 +564,14 @@ vacuum_set_xid_limits(Relation rel,
562
564
Assert (mxid_freezemin >= 0 );
563
565
564
566
/* compute the cutoff multi, being careful to generate a valid value */
565
- mxactLimit = GetOldestMultiXactId () - mxid_freezemin ;
566
- if (mxactLimit < FirstMultiXactId )
567
- mxactLimit = FirstMultiXactId ;
567
+ mxactLimit = GetOldestMultiXactId ();
568
+ if (mxactLimit > FirstMultiXactId + mxid_freezemin )
569
+ mxactLimit -= mxid_freezemin ;
568
570
569
- safeMxactLimit =
570
- ReadNextMultiXactId () - effective_multixact_freeze_max_age ;
571
- if (safeMxactLimit < FirstMultiXactId )
571
+ nextMxactId = ReadNextMultiXactId ();
572
+ if (nextMxactId > FirstMultiXactId + effective_multixact_freeze_max_age )
573
+ safeMxactLimit = nextMxactId - effective_multixact_freeze_max_age ;
574
+ else
572
575
safeMxactLimit = FirstMultiXactId ;
573
576
574
577
if (MultiXactIdPrecedes (mxactLimit , safeMxactLimit ))
0 commit comments