Skip to content

Commit 580bde7

Browse files
committed
Initialize shared memory copy of ckptXidEpoch correctly when not in recovery.
This bug was introduced by commit 20d98ab, so backpatch this to 9.0-9.2 like that one. This fixes bug #6710, reported by Tarvi Pillessaar
1 parent 38a9052 commit 580bde7

File tree

1 file changed

+3
-4
lines changed
  • src/backend/access/transam

1 file changed

+3
-4
lines changed

src/backend/access/transam/xlog.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5941,11 +5941,14 @@ StartupXLOG(void)
59415941
ereport(PANIC,
59425942
(errmsg("invalid next transaction ID")));
59435943

5944+
/* initialize shared memory variables from the checkpoint record */
59445945
ShmemVariableCache->nextXid = checkPoint.nextXid;
59455946
ShmemVariableCache->nextOid = checkPoint.nextOid;
59465947
ShmemVariableCache->oidCount = 0;
59475948
MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset);
59485949
SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB);
5950+
XLogCtl->ckptXidEpoch = checkPoint.nextXidEpoch;
5951+
XLogCtl->ckptXid = checkPoint.nextXid;
59495952

59505953
/*
59515954
* We must replay WAL entries using the same TimeLineID they were created
@@ -6022,10 +6025,6 @@ StartupXLOG(void)
60226025
/* No need to hold ControlFileLock yet, we aren't up far enough */
60236026
UpdateControlFile();
60246027

6025-
/* initialize shared-memory copy of latest checkpoint XID/epoch */
6026-
XLogCtl->ckptXidEpoch = ControlFile->checkPointCopy.nextXidEpoch;
6027-
XLogCtl->ckptXid = ControlFile->checkPointCopy.nextXid;
6028-
60296028
/* initialize our local copy of minRecoveryPoint */
60306029
minRecoveryPoint = ControlFile->minRecoveryPoint;
60316030

0 commit comments

Comments
 (0)