public inbox for [email protected]
help / color / mirror / Atom feedFrom: Álvaro Herrera <[email protected]>
Subject: [PATCH 2/2] What about just ignoring the xacts if they're still running?
Date: Fri, 20 Mar 2026 15:58:05 +0100
---
src/backend/replication/logical/snapbuild.c | 37 +++++----------------
1 file changed, 8 insertions(+), 29 deletions(-)
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index d7ea098cb37..2a4581b75a6 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder)
snapshot->xmin = builder->xmin;
snapshot->xmax = builder->xmax;
- /*
- * Although it's very unlikely, it's possible that a commit WAL record was
- * decoded but CLOG is not aware of the commit yet. Should the CLOG update
- * be delayed even more, visibility checks that use this snapshot could
- * work incorrectly. Therefore we check the CLOG status here.
- */
- for (int i = 0; i < builder->committed.xcnt; i++)
- {
- for (;;)
- {
- if (TransactionIdDidCommit(builder->committed.xip[i]))
- break;
- else
- {
- (void) WaitLatch(MyLatch,
- WL_LATCH_SET | WL_TIMEOUT |
- WL_EXIT_ON_PM_DEATH,
- 10L,
- WAIT_EVENT_SNAPBUILD_CLOG);
- ResetLatch(MyLatch);
- }
- CHECK_FOR_INTERRUPTS();
- }
- }
-
/* store all transactions to be treated as committed by this snapshot */
snapshot->xip =
(TransactionId *) ((char *) snapshot + sizeof(SnapshotData));
- snapshot->xcnt = builder->committed.xcnt;
- memcpy(snapshot->xip,
- builder->committed.xip,
- builder->committed.xcnt * sizeof(TransactionId));
+
+ for (int i = 0; i < builder->committed.xcnt; i++)
+ {
+ if (!TransactionIdIsInProgress(builder->committed.xip[i]))
+ {
+ snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i];
+ }
+ }
/* sort so we can bsearch() */
qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator);
--
2.47.3
--obdbyrpgpb3edptv--
view thread (396+ messages) latest in thread
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]
Subject: Re: [PATCH 2/2] What about just ignoring the xacts if they're still running?
In-Reply-To: <no-message-id-1454096@localhost>
* 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