Skip to content

Commit 29809bd

Browse files
author
Alexander Korotkov
committed
Fix multixact wraparoud warning.
1 parent ddbf473 commit 29809bd

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/backend/commands/vacuum.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,11 @@ vacuum_set_xid_limits(Relation rel,
483483
int mxid_freezemin;
484484
int effective_multixact_freeze_max_age;
485485
TransactionId limit;
486-
TransactionId safeLimit, nextXid;
486+
TransactionId safeLimit;
487+
TransactionId nextXid;
487488
MultiXactId mxactLimit;
488489
MultiXactId safeMxactLimit;
490+
MultiXactId nextMxactId;
489491

490492
/*
491493
* We can always ignore processes running lazy vacuum. This is because we
@@ -562,13 +564,14 @@ vacuum_set_xid_limits(Relation rel,
562564
Assert(mxid_freezemin >= 0);
563565

564566
/* 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;
568570

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
572575
safeMxactLimit = FirstMultiXactId;
573576

574577
if (MultiXactIdPrecedes(mxactLimit, safeMxactLimit))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy