Skip to content

Commit 34015b9

Browse files
author
Alexander Korotkov
committed
Fix non-wraparound xids.
1 parent 2a114d0 commit 34015b9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4801,6 +4801,7 @@ BootStrapXLOG(void)
48014801
checkPoint.PrevTimeLineID = ThisTimeLineID;
48024802
checkPoint.fullPageWrites = fullPageWrites;
48034803
checkPoint.nextXid = FirstNormalTransactionId;
4804+
TransactionIdAdvance(checkPoint.nextXid);
48044805
checkPoint.nextOid = FirstBootstrapObjectId;
48054806
checkPoint.nextMulti = FirstMultiXactId;
48064807
checkPoint.nextMultiOffset = 0;

src/include/access/transam.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@
5656
#define TransactionIdAdvance(dest) \
5757
do { \
5858
(dest)++; \
59-
if ((dest) < FirstNormalTransactionId) \
60-
(dest) = FirstNormalTransactionId; \
59+
Assert((dest) > FirstNormalTransactionId); \
6160
} while(0)
6261

6362
/* back up a transaction ID variable, handling wraparound correctly */
6463
#define TransactionIdRetreat(dest) \
6564
do { \
65+
Assert((dest) > FirstNormalTransactionId); \
6666
(dest)--; \
67-
} while ((dest) < FirstNormalTransactionId)
67+
} while(0)
6868

6969
/* compare two XIDs already known to be normal; this is a macro for speed */
7070
#define NormalTransactionIdPrecedes(id1, id2) \

0 commit comments

Comments
 (0)