agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH v5 5/6] Handle pg_get_expr default args in system_functions.sql 484+ messages / 2 participants [nested] [flat]
* [PATCH v5 5/6] Handle pg_get_expr default args in system_functions.sql @ 2025-12-09 19:17 Mark Wong <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Mark Wong @ 2025-12-09 19:17 UTC (permalink / raw) Modernize pg_get_expr to use proargdefaults to handle the optional pretty argument. That also means any direct function calls now needs to set the pretty parameter. --- src/backend/commands/tablecmds.c | 5 +++-- src/backend/utils/adt/ruleutils.c | 17 ----------------- src/include/catalog/pg_proc.dat | 7 +++---- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 0ce2e81f9c2..fad4202b1ff 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17694,8 +17694,9 @@ decompile_conbin(HeapTuple contup, TupleDesc tupdesc) if (isnull) elog(ERROR, "null conbin for constraint %u", con->oid); - expr = DirectFunctionCall2(pg_get_expr, attr, - ObjectIdGetDatum(con->conrelid)); + expr = DirectFunctionCall3(pg_get_expr, attr, + ObjectIdGetDatum(con->conrelid), + BoolGetDatum(false)); return TextDatumGetCString(expr); } diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 1afa2531f30..972f89eafbc 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -2932,23 +2932,6 @@ decompile_column_index_array(Datum column_index_array, Oid relId, */ Datum pg_get_expr(PG_FUNCTION_ARGS) -{ - text *expr = PG_GETARG_TEXT_PP(0); - Oid relid = PG_GETARG_OID(1); - text *result; - int prettyFlags; - - prettyFlags = PRETTYFLAG_INDENT; - - result = pg_get_expr_worker(expr, relid, prettyFlags); - if (result) - PG_RETURN_TEXT_P(result); - else - PG_RETURN_NULL(); -} - -Datum -pg_get_expr_ext(PG_FUNCTION_ARGS) { text *expr = PG_GETARG_TEXT_PP(0); Oid relid = PG_GETARG_OID(1); diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index e148b1ad8e3..f36f4625e50 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -4000,9 +4000,6 @@ { oid => '1662', descr => 'trigger description', proname => 'pg_get_triggerdef', provolatile => 's', prorettype => 'text', proargtypes => 'oid', prosrc => 'pg_get_triggerdef' }, -{ oid => '1716', descr => 'deparse an encoded expression', - proname => 'pg_get_expr', provolatile => 's', prorettype => 'text', - proargtypes => 'pg_node_tree oid', prosrc => 'pg_get_expr' }, { oid => '1665', descr => 'name of sequence for a serial column', proname => 'pg_get_serial_sequence', provolatile => 's', prorettype => 'text', proargtypes => 'text text', prosrc => 'pg_get_serial_sequence' }, @@ -8595,7 +8592,9 @@ { oid => '2509', descr => 'deparse an encoded expression with pretty-print option', proname => 'pg_get_expr', provolatile => 's', prorettype => 'text', - proargtypes => 'pg_node_tree oid bool', prosrc => 'pg_get_expr_ext' }, + proargtypes => 'pg_node_tree oid bool', + proargnames => '{expr,relation,pretty}', proargdefaults => '{false}', + prosrc => 'pg_get_expr' }, { oid => '2510', descr => 'get the prepared statements for this session', proname => 'pg_prepared_statement', prorows => '1000', proretset => 't', provolatile => 's', proparallel => 'r', prorettype => 'record', -- 2.52.0 --m23X5uHFNxthGTU3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v5-0006-Handle-pg_get_triggerdef-default-args-in-system_f.patch ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- 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-- ^ permalink raw reply [nested|flat] 484+ messages in thread
end of thread, other threads:[~2026-03-20 14:58 UTC | newest] Thread overview: 484+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-12-09 19:17 [PATCH v5 5/6] Handle pg_get_expr default args in system_functions.sql Mark Wong <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]> 2026-03-20 14:58 [PATCH 2/2] What about just ignoring the xacts if they're still running? Álvaro Herrera <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox