Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comment explaining why it is safe to use FirstNormalTransactionXid for oldestActiveXid while replica startup #388

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/backend/access/transam/xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -5194,13 +5194,13 @@ StartupXLOG(void)
else if (!TransactionIdIsValid(checkPoint.oldestActiveXid))
{
/*
* It should not actually happen: PS oldestActiveXid
* from running xacts WAL records and include it in checkpoint
* sent in basebackup.
* FirstNormalTransactionId is conservative estimation of oldest active XACT, unless
* current XID is greater than 1^31. So it is also not 100% safe solution but better than assertion failure.
* Pageserver extracts oldestActiveXid from snapshot and running xacts WAL records
* and include it in checkpoint sent in basebackup.
* So oldestActiveXid can be zero only after database initialization when no checkpoints are yet performed
* and not running xacts records was logged.
* In this case it is possible to use FirstNormalTransactionId as safe conservative estimation
* of oldest active transaction XID.
*/
elog(FATAL, "oldestActiveXid=%d", checkPoint.oldestActiveXid);
checkPoint.oldestActiveXid = FirstNormalTransactionId;
}
}
Expand Down