@@ -745,13 +745,13 @@ vac_update_relstats(Relation relation,
745745 * which case we don't want to forget the work it already did. However,
746746 * if the stored relfrozenxid is "in the future", then it must be corrupt
747747 * and it seems best to overwrite it with the cutoff we used this time.
748- *See vac_update_datfrozenxid() concerning what we consider to be "in the
749- * future".
748+ *This should match vac_update_datfrozenxid() concerning what we consider
749+ *to be "in the future".
750750 */
751751if (TransactionIdIsNormal (frozenxid )&&
752752pgcform -> relfrozenxid != frozenxid &&
753753(TransactionIdPrecedes (pgcform -> relfrozenxid ,frozenxid )||
754- TransactionIdPrecedes (GetOldestXmin ( NULL , true ),
754+ TransactionIdPrecedes (ReadNewTransactionId ( ),
755755pgcform -> relfrozenxid )))
756756{
757757pgcform -> relfrozenxid = frozenxid ;
@@ -762,7 +762,7 @@ vac_update_relstats(Relation relation,
762762if (MultiXactIdIsValid (minmulti )&&
763763pgcform -> relminmxid != minmulti &&
764764(MultiXactIdPrecedes (pgcform -> relminmxid ,minmulti )||
765- MultiXactIdPrecedes (GetOldestMultiXactId (),pgcform -> relminmxid )))
765+ MultiXactIdPrecedes (ReadNextMultiXactId (),pgcform -> relminmxid )))
766766{
767767pgcform -> relminmxid = minmulti ;
768768dirty = true;
@@ -803,8 +803,8 @@ vac_update_datfrozenxid(void)
803803SysScanDesc scan ;
804804HeapTuple classTup ;
805805TransactionId newFrozenXid ;
806- TransactionId lastSaneFrozenXid ;
807806MultiXactId newMinMulti ;
807+ TransactionId lastSaneFrozenXid ;
808808MultiXactId lastSaneMinMulti ;
809809bool bogus = false;
810810bool dirty = false;
@@ -815,13 +815,21 @@ vac_update_datfrozenxid(void)
815815 * committed pg_class entries for new tables; see AddNewRelationTuple().
816816 * So we cannot produce a wrong minimum by starting with this.
817817 */
818- newFrozenXid = lastSaneFrozenXid = GetOldestXmin (NULL , true);
818+ newFrozenXid = GetOldestXmin (NULL , true);
819819
820820/*
821821 * Similarly, initialize the MultiXact "min" with the value that would be
822822 * used on pg_class for new tables. See AddNewRelationTuple().
823823 */
824- newMinMulti = lastSaneMinMulti = GetOldestMultiXactId ();
824+ newMinMulti = GetOldestMultiXactId ();
825+
826+ /*
827+ * Identify the latest relfrozenxid and relminmxid values that we could
828+ * validly see during the scan. These are conservative values, but it's
829+ * not really worth trying to be more exact.
830+ */
831+ lastSaneFrozenXid = ReadNewTransactionId ();
832+ lastSaneMinMulti = ReadNextMultiXactId ();
825833
826834/*
827835 * We must seqscan pg_class to find the minimum Xid, because there is no