summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2025-07-04 06:10:25 +0000
committerMichael Paquier2025-07-04 06:10:25 +0000
commit8bca4476f9f9b364506f20973f9a3635101bbbb0 (patch)
treea076feef6758a7d2033cd09c8ce4097551821b19
parentf9ba071cc5bdd2a98c361b5a75e995ffaa0ec787 (diff)
Disable commit timestamps during bootstrap
Attempting to use commit timestamps during bootstrapping leads to an assertion failure, that can be reached for example with an initdb -c that enables track_commit_timestamp. It makes little sense to register a commit timestamp for a BootstrapTransactionId, so let's disable the activation of the module in this case. This problem has been independently reported once by each author of this commit. Each author has proposed basically the same patch, relying on IsBootstrapProcessingMode() to skip the use of commit_ts during bootstrap. The test addition is a suggestion by me, and is applied down to v16. Author: Hayato Kuroda <[email protected]> Author: Andy Fan <[email protected]> Reviewed-by: Bertrand Drouvot <[email protected]> Reviewed-by: Fujii Masao <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Discussion: https://postgr.es/m/OSCPR01MB14966FF9E4C4145F37B937E52F5102@OSCPR01MB14966.jpnprd01.prod.outlook.com Discussion: https://postgr.es/m/[email protected] Backpatch-through: 13
-rw-r--r--src/backend/access/transam/commit_ts.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index 31b66425647..21b8116d798 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -637,6 +637,13 @@ ActivateCommitTs(void)
TransactionId xid;
int pageno;
+ /*
+ * During bootstrap, we should not register commit timestamps so skip the
+ * activation in this case.
+ */
+ if (IsBootstrapProcessingMode())
+ return;
+
/* If we've done this already, there's nothing to do */
LWLockAcquire(CommitTsLock, LW_EXCLUSIVE);
if (commitTsShared->commitTsActive)