Skip to content

Commit facc780

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

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
@@ -5343,13 +5343,13 @@ StartupXLOG(void)
53435343
else if (!TransactionIdIsValid(checkPoint.oldestActiveXid))
53445344
{
53455345
/*
5346-
* It should not actually happen: PS oldestActiveXid
5347-
* from running xacts WAL records and include it in checkpoint
5348-
* sent in basebackup.
5349-
* FirstNormalTransactionId is conservative estimation of oldest active XACT, unless
5350-
* current XID is greater than 1^31. So it is also not 100% safe solution but better than assertion failure.
5346+
* Pageserver extracts oldestActiveXid from snapshot and running xacts WAL records
5347+
* and include it in checkpoint sent in basebackup.
5348+
* So oldestActiveXid can be zero only after database initialization when no checkpoints are yet performed
5349+
* and not running xacts records was logged.
5350+
* In this case it is possible to use FirstNormalTransactionId as safe conservative estimation
5351+
* of oldest active transaction XID.
53515352
*/
5352-
elog(FATAL, "oldestActiveXid=%d", checkPoint.oldestActiveXid);
53535353
checkPoint.oldestActiveXid = FirstNormalTransactionId;
53545354
}
53555355
}

0 commit comments

Comments
 (0)