public inbox for [email protected]
help / color / mirror / Atom feedFrom: Hayato Kuroda (Fujitsu) <[email protected]>
To: '[email protected]' <[email protected]>
Subject: initdb -c "track_commit_timestamp=on" crashes in case of debug build
Date: Mon, 6 Jan 2025 13:14:44 +0000
Message-ID: <OSCPR01MB14966FF9E4C4145F37B937E52F5102@OSCPR01MB14966.jpnprd01.prod.outlook.com> (raw)
Hi hackers,
While working on another thread I found $subject. I've tested only on master,
but I doubt this could happen even on PG16 and 17. You can reproduce by:
```
$ initdb -D data -c "track_commit_timestamp=on"
...
child process was terminated by signal 6: Aborted
initdb: removing data directory "data"
```
Back-trace I got is shown in [1].
IIUC the crash was caused at TransactionIdSetCommitTs(), and the primal reason was that
commit_ts module tried to store the bootstrap transaction.
In the first place I'm not sure we want to fix this because this happens only for
the debug mode... but if needed, the easiest way is not to activate the commit_ts
in the bootstrap mode. I think this fix is enough because pg_last_committed_xact()
and TransactionIdGetCommitTsData() won't seek the un-normal xid.
Attached patch was created based on the idea.
Thought?
[1]:
```
(gdb) bt
#0 0x00007f1da8dd8387 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:55
#1 0x00007f1da8dd9a78 in __GI_abort () at abort.c:90
#2 0x0000000000bd3c0c in ExceptionalCondition (conditionName=0xc7a21b "TransactionIdIsNormal(xid)",
fileName=0xc7a20f "commit_ts.c", lineNumber=255) at assert.c:66
#3 0x000000000056467f in TransactionIdSetCommitTs (xid=1, ts=789482588771230, nodeid=0, slotno=0) at commit_ts.c:255
#4 0x00000000005645c3 in SetXidCommitTsInPage (xid=1, nsubxids=0, subxids=0x0, ts=789482588771230, nodeid=0, pageno=0)
at commit_ts.c:234
#5 0x0000000000564494 in TransactionTreeSetCommitTsData (xid=1, nsubxids=0, subxids=0x0, timestamp=789482588771230,
nodeid=0) at commit_ts.c:190
#6 0x0000000000579c18 in RecordTransactionCommit () at xact.c:1467
#7 0x000000000057aa15 in CommitTransaction () at xact.c:2364
#8 0x000000000057b7cf in CommitTransactionCommandInternal () at xact.c:3194
#9 0x000000000057b738 in CommitTransactionCommand () at xact.c:3155
#10 0x00000000005b1b0e in BootstrapModeMain (argc=7, argv=0x1be1048, check_only=false) at bootstrap.c:390
#11 0x00000000007de1c5 in main (argc=8, argv=0x1be1040) at main.c:21
```
Best regards,
Hayato Kuroda
FUJITSU LIMITED
Attachments:
[application/octet-stream] 0001-Avoid-activating-commit_ts-while-bootstrap.patch (910B, ../OSCPR01MB14966FF9E4C4145F37B937E52F5102@OSCPR01MB14966.jpnprd01.prod.outlook.com/2-0001-Avoid-activating-commit_ts-while-bootstrap.patch)
download | inline diff:
From 8d1903ebca853bb74e524bd4bf01ec678481e50e Mon Sep 17 00:00:00 2001
From: Hayato Kuroda <[email protected]>
Date: Mon, 6 Jan 2025 13:08:04 +0000
Subject: [PATCH] Avoid activating commit_ts while bootstrap
---
src/backend/access/transam/commit_ts.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index 95049acd0b..ea42d3a95e 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -707,6 +707,13 @@ ActivateCommitTs(void)
TransactionId xid;
int64 pageno;
+ /*
+ * commit_ts assumes that we are not in the bootstrap mode: skip the
+ * activation.
+ */
+ if (IsBootstrapProcessingMode())
+ return;
+
/* If we've done this already, there's nothing to do */
LWLockAcquire(CommitTsLock, LW_EXCLUSIVE);
if (commitTsShared->commitTsActive)
--
2.43.0
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: initdb -c "track_commit_timestamp=on" crashes in case of debug build
In-Reply-To: <OSCPR01MB14966FF9E4C4145F37B937E52F5102@OSCPR01MB14966.jpnprd01.prod.outlook.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox