Skip to content

Commit 79b6351

Browse files
knizhnikKonstantin Knizhnik
andauthored
Add comment explaining why it is safe to use FirstNormalTransactionXid for oldestActiveXid while replica startup (#388)
Co-authored-by: Konstantin Knizhnik <knizhnik@neon.tech>
1 parent be91d91 commit 79b6351

File tree

1 file changed

+6
-6
lines changed
  • src/backend/access/transam

1 file changed

+6
-6
lines changed

src/backend/access/transam/xlog.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5194,13 +5194,13 @@ StartupXLOG(void)
51945194
else if (!TransactionIdIsValid(checkPoint.oldestActiveXid))
51955195
{
51965196
/*
5197-
* It should not actually happen: PS oldestActiveXid
5198-
* from running xacts WAL records and include it in checkpoint
5199-
* sent in basebackup.
5200-
* FirstNormalTransactionId is conservative estimation of oldest active XACT, unless
5201-
* current XID is greater than 1^31. So it is also not 100% safe solution but better than assertion failure.
5197+
* Pageserver extracts oldestActiveXid from snapshot and running xacts WAL records
5198+
* and include it in checkpoint sent in basebackup.
5199+
* So oldestActiveXid can be zero only after database initialization when no checkpoints are yet performed
5200+
* and not running xacts records was logged.
5201+
* In this case it is possible to use FirstNormalTransactionId as safe conservative estimation
5202+
* of oldest active transaction XID.
52025203
*/
5203-
elog(FATAL, "oldestActiveXid=%d", checkPoint.oldestActiveXid);
52045204
checkPoint.oldestActiveXid = FirstNormalTransactionId;
52055205
}
52065206
}

0 commit comments

Comments
 (0)