agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH v8.1 6/6] Handle pg_get_triggerdef default args in system_functions.sql 484+ messages / 2 participants [nested] [flat]
* [PATCH v8.1 6/6] Handle pg_get_triggerdef default args in system_functions.sql @ 2025-12-09 19:51 Mark Wong <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Mark Wong @ 2025-12-09 19:51 UTC (permalink / raw) Modernize pg_get_triggerdef to use proargdefaults to handle the optional pretty argument. --- src/backend/utils/adt/ruleutils.c | 14 -------------- src/include/catalog/pg_proc.dat | 8 +++----- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index e60478677e0..bfa5ef7910b 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -818,20 +818,6 @@ pg_get_viewdef_worker(Oid viewoid, int prettyFlags, int wrapColumn) */ Datum pg_get_triggerdef(PG_FUNCTION_ARGS) -{ - Oid trigid = PG_GETARG_OID(0); - char *res; - - res = pg_get_triggerdef_worker(trigid, false); - - if (res == NULL) - PG_RETURN_NULL(); - - PG_RETURN_TEXT_P(string_to_text(res)); -} - -Datum -pg_get_triggerdef_ext(PG_FUNCTION_ARGS) { Oid trigid = PG_GETARG_OID(0); bool pretty = PG_GETARG_BOOL(1); diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index df43469be3d..7cccfe6d7a7 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -4003,9 +4003,6 @@ proname => 'pg_get_partition_constraintdef', provolatile => 's', prorettype => 'text', proargtypes => 'oid', prosrc => 'pg_get_partition_constraintdef' }, -{ oid => '1662', descr => 'trigger description', - proname => 'pg_get_triggerdef', provolatile => 's', prorettype => 'text', - proargtypes => 'oid', prosrc => 'pg_get_triggerdef' }, { 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' }, @@ -8640,9 +8637,10 @@ proallargtypes => '{text,text,interval,bool}', proargmodes => '{o,o,o,o}', proargnames => '{name,abbrev,utc_offset,is_dst}', prosrc => 'pg_timezone_names' }, -{ oid => '2730', descr => 'trigger description with pretty-print option', +{ oid => '2730', descr => 'trigger description', proname => 'pg_get_triggerdef', provolatile => 's', prorettype => 'text', - proargtypes => 'oid bool', prosrc => 'pg_get_triggerdef_ext' }, + proargtypes => 'oid bool', proargnames => '{trigger,pretty}', + proargdefaults => '{false}', prosrc => 'pg_get_triggerdef' }, # asynchronous notifications { oid => '3035', -- 2.53.0 --AcCatzXgbvyipyEy-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so we can bsearch() */ qsort(snapshot->xip, snapshot->xcnt, sizeof(TransactionId), xidComparator); -- 2.47.3 --obdbyrpgpb3edptv-- ^ permalink raw reply [nested|flat] 484+ messages in thread
* [PATCH 2/2] What about just ignoring the xacts if they're still running? @ 2026-03-20 14:58 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 484+ messages in thread From: Álvaro Herrera @ 2026-03-20 14:58 UTC (permalink / raw) --- src/backend/replication/logical/snapbuild.c | 37 +++++---------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index d7ea098cb37..2a4581b75a6 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -402,38 +402,17 @@ SnapBuildBuildSnapshot(SnapBuild *builder) snapshot->xmin = builder->xmin; snapshot->xmax = builder->xmax; - /* - * Although it's very unlikely, it's possible that a commit WAL record was - * decoded but CLOG is not aware of the commit yet. Should the CLOG update - * be delayed even more, visibility checks that use this snapshot could - * work incorrectly. Therefore we check the CLOG status here. - */ - for (int i = 0; i < builder->committed.xcnt; i++) - { - for (;;) - { - if (TransactionIdDidCommit(builder->committed.xip[i])) - break; - else - { - (void) WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | - WL_EXIT_ON_PM_DEATH, - 10L, - WAIT_EVENT_SNAPBUILD_CLOG); - ResetLatch(MyLatch); - } - CHECK_FOR_INTERRUPTS(); - } - } - /* store all transactions to be treated as committed by this snapshot */ snapshot->xip = (TransactionId *) ((char *) snapshot + sizeof(SnapshotData)); - snapshot->xcnt = builder->committed.xcnt; - memcpy(snapshot->xip, - builder->committed.xip, - builder->committed.xcnt * sizeof(TransactionId)); + + for (int i = 0; i < builder->committed.xcnt; i++) + { + if (!TransactionIdIsInProgress(builder->committed.xip[i])) + { + snapshot->xip[snapshot->xcnt++] = builder->committed.xip[i]; + } + } /* sort so 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:51 [PATCH v8.1 6/6] Handle pg_get_triggerdef 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