agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Fix race condition in subscription TAP test 021_twophase 9+ messages / 2 participants [nested] [flat]
* pgsql: Fix race condition in subscription TAP test 021_twophase @ 2025-05-26 08:29 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 9+ messages in thread From: Michael Paquier @ 2025-05-26 08:29 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition in subscription TAP test 021_twophase The test did not wait for all the subscriptions to have caught up when dropping the subscription "tab_copy". In a slow environment, it could be possible for the replay of the COMMIT PREPARED transaction "mygid" to not be confirmed yet, causing one prepared transaction to be left around before moving to the next steps of the test. One failure noticed is a transaction found in pg_prepared_xacts for the cases where copy_data = false and two_phase = true, but there should be none after dropping the subscription. As an extra safety measure, a check is added before dropping the subscription, scanning pg_prepared_xacts to make sure that no prepared transactions are left once both subscriptions have caught up. Issue introduced by a8fd13cab0ba, fixing a problem similar to eaf5321c3524. Per buildfarm member kestrel. Author: Vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CALDaNm329QaZ+bwU--bW6GjbNSZ8-38cDE8QWofafub7NV67oA@mail.gmail.com Backpatch-through: 15 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/52a1df85f29b7955e33e5ce69bc8b46ee499dbfd Modified Files -------------- src/test/subscription/t/021_twophase.pl | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 9+ messages in thread
* pgsql: Fix race condition in subscription TAP test 021_twophase @ 2025-05-26 08:29 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 9+ messages in thread From: Michael Paquier @ 2025-05-26 08:29 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition in subscription TAP test 021_twophase The test did not wait for all the subscriptions to have caught up when dropping the subscription "tab_copy". In a slow environment, it could be possible for the replay of the COMMIT PREPARED transaction "mygid" to not be confirmed yet, causing one prepared transaction to be left around before moving to the next steps of the test. One failure noticed is a transaction found in pg_prepared_xacts for the cases where copy_data = false and two_phase = true, but there should be none after dropping the subscription. As an extra safety measure, a check is added before dropping the subscription, scanning pg_prepared_xacts to make sure that no prepared transactions are left once both subscriptions have caught up. Issue introduced by a8fd13cab0ba, fixing a problem similar to eaf5321c3524. Per buildfarm member kestrel. Author: Vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CALDaNm329QaZ+bwU--bW6GjbNSZ8-38cDE8QWofafub7NV67oA@mail.gmail.com Backpatch-through: 15 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6ea812f4dc634af01feb06fc3da45d53f5a1ec83 Modified Files -------------- src/test/subscription/t/021_twophase.pl | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 9+ messages in thread
* pgsql: Fix race condition in subscription TAP test 021_twophase @ 2025-05-26 08:29 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 9+ messages in thread From: Michael Paquier @ 2025-05-26 08:29 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition in subscription TAP test 021_twophase The test did not wait for all the subscriptions to have caught up when dropping the subscription "tab_copy". In a slow environment, it could be possible for the replay of the COMMIT PREPARED transaction "mygid" to not be confirmed yet, causing one prepared transaction to be left around before moving to the next steps of the test. One failure noticed is a transaction found in pg_prepared_xacts for the cases where copy_data = false and two_phase = true, but there should be none after dropping the subscription. As an extra safety measure, a check is added before dropping the subscription, scanning pg_prepared_xacts to make sure that no prepared transactions are left once both subscriptions have caught up. Issue introduced by a8fd13cab0ba, fixing a problem similar to eaf5321c3524. Per buildfarm member kestrel. Author: Vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CALDaNm329QaZ+bwU--bW6GjbNSZ8-38cDE8QWofafub7NV67oA@mail.gmail.com Backpatch-through: 15 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a7d3e32c8c0390d4ac1bb086d58340715ee32a46 Modified Files -------------- src/test/subscription/t/021_twophase.pl | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 9+ messages in thread
* pgsql: Fix race condition in subscription TAP test 021_twophase @ 2025-05-26 08:29 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 9+ messages in thread From: Michael Paquier @ 2025-05-26 08:29 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition in subscription TAP test 021_twophase The test did not wait for all the subscriptions to have caught up when dropping the subscription "tab_copy". In a slow environment, it could be possible for the replay of the COMMIT PREPARED transaction "mygid" to not be confirmed yet, causing one prepared transaction to be left around before moving to the next steps of the test. One failure noticed is a transaction found in pg_prepared_xacts for the cases where copy_data = false and two_phase = true, but there should be none after dropping the subscription. As an extra safety measure, a check is added before dropping the subscription, scanning pg_prepared_xacts to make sure that no prepared transactions are left once both subscriptions have caught up. Issue introduced by a8fd13cab0ba, fixing a problem similar to eaf5321c3524. Per buildfarm member kestrel. Author: Vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CALDaNm329QaZ+bwU--bW6GjbNSZ8-38cDE8QWofafub7NV67oA@mail.gmail.com Backpatch-through: 15 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6b0d69d34396685dfeadbb288754ce9146955b38 Modified Files -------------- src/test/subscription/t/021_twophase.pl | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 9+ messages in thread
* pgsql: Fix race condition in subscription TAP test 023_twophase_stream. @ 2026-08-06 06:17 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 9+ messages in thread From: Amit Kapila @ 2026-08-06 06:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition in subscription TAP test 023_twophase_stream. Buildfarm member olingo intermittently failed this test, timing out while waiting for the subscriber log to report an ERROR because max_prepared_transactions is zero there. The test captured the log offset only after issuing the publisher's BEGIN/INSERT/PREPARE TRANSACTION/COMMIT PREPARED sequence. Since streaming is enabled, the subscriber can receive and apply the transaction, and log the expected ERROR, before that publisher SQL command even returns, i.e. before the test captures the offset. The subsequent wait_for_log() calls then searched only from a point after the message had already been written, and timed out waiting for it. Fix by moving the offset capture to before the publisher's transaction is issued, ensuring it always precedes the point where the ERROR can appear in the subscriber log. Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Zhijie Hou <houzj.fnst@fujitsu.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Backpatch-through: 16, where test was introduced Discussion: https://postgr.es/m/c43753d8-5265-4f77-83ff-9b1167276ec5@gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/4790abd112fcb889bac3e1e45b2e7238d48184e5 Modified Files -------------- src/test/subscription/t/023_twophase_stream.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 9+ messages in thread
* pgsql: Fix race condition in subscription TAP test 023_twophase_stream. @ 2026-08-06 06:17 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 9+ messages in thread From: Amit Kapila @ 2026-08-06 06:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition in subscription TAP test 023_twophase_stream. Buildfarm member olingo intermittently failed this test, timing out while waiting for the subscriber log to report an ERROR because max_prepared_transactions is zero there. The test captured the log offset only after issuing the publisher's BEGIN/INSERT/PREPARE TRANSACTION/COMMIT PREPARED sequence. Since streaming is enabled, the subscriber can receive and apply the transaction, and log the expected ERROR, before that publisher SQL command even returns, i.e. before the test captures the offset. The subsequent wait_for_log() calls then searched only from a point after the message had already been written, and timed out waiting for it. Fix by moving the offset capture to before the publisher's transaction is issued, ensuring it always precedes the point where the ERROR can appear in the subscriber log. Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Zhijie Hou <houzj.fnst@fujitsu.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Backpatch-through: 16, where test was introduced Discussion: https://postgr.es/m/c43753d8-5265-4f77-83ff-9b1167276ec5@gmail.com Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f4e44f184cef6a80b4d11bbaeaf2b13e59c1dd8e Modified Files -------------- src/test/subscription/t/023_twophase_stream.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 9+ messages in thread
* pgsql: Fix race condition in subscription TAP test 023_twophase_stream. @ 2026-08-06 06:17 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 9+ messages in thread From: Amit Kapila @ 2026-08-06 06:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition in subscription TAP test 023_twophase_stream. Buildfarm member olingo intermittently failed this test, timing out while waiting for the subscriber log to report an ERROR because max_prepared_transactions is zero there. The test captured the log offset only after issuing the publisher's BEGIN/INSERT/PREPARE TRANSACTION/COMMIT PREPARED sequence. Since streaming is enabled, the subscriber can receive and apply the transaction, and log the expected ERROR, before that publisher SQL command even returns, i.e. before the test captures the offset. The subsequent wait_for_log() calls then searched only from a point after the message had already been written, and timed out waiting for it. Fix by moving the offset capture to before the publisher's transaction is issued, ensuring it always precedes the point where the ERROR can appear in the subscriber log. Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Zhijie Hou <houzj.fnst@fujitsu.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Backpatch-through: 16, where test was introduced Discussion: https://postgr.es/m/c43753d8-5265-4f77-83ff-9b1167276ec5@gmail.com Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b37f14875a284b7bf3c5ec2e3691aa5d8bf8e736 Modified Files -------------- src/test/subscription/t/023_twophase_stream.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 9+ messages in thread
* pgsql: Fix race condition in subscription TAP test 023_twophase_stream. @ 2026-08-06 06:17 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 9+ messages in thread From: Amit Kapila @ 2026-08-06 06:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition in subscription TAP test 023_twophase_stream. Buildfarm member olingo intermittently failed this test, timing out while waiting for the subscriber log to report an ERROR because max_prepared_transactions is zero there. The test captured the log offset only after issuing the publisher's BEGIN/INSERT/PREPARE TRANSACTION/COMMIT PREPARED sequence. Since streaming is enabled, the subscriber can receive and apply the transaction, and log the expected ERROR, before that publisher SQL command even returns, i.e. before the test captures the offset. The subsequent wait_for_log() calls then searched only from a point after the message had already been written, and timed out waiting for it. Fix by moving the offset capture to before the publisher's transaction is issued, ensuring it always precedes the point where the ERROR can appear in the subscriber log. Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Zhijie Hou <houzj.fnst@fujitsu.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Backpatch-through: 16, where test was introduced Discussion: https://postgr.es/m/c43753d8-5265-4f77-83ff-9b1167276ec5@gmail.com Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3df129b8d7217e50e7dfbc501c0e00e46320fabd Modified Files -------------- src/test/subscription/t/023_twophase_stream.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 9+ messages in thread
* pgsql: Fix race condition in subscription TAP test 023_twophase_stream. @ 2026-08-06 06:17 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 9+ messages in thread From: Amit Kapila @ 2026-08-06 06:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition in subscription TAP test 023_twophase_stream. Buildfarm member olingo intermittently failed this test, timing out while waiting for the subscriber log to report an ERROR because max_prepared_transactions is zero there. The test captured the log offset only after issuing the publisher's BEGIN/INSERT/PREPARE TRANSACTION/COMMIT PREPARED sequence. Since streaming is enabled, the subscriber can receive and apply the transaction, and log the expected ERROR, before that publisher SQL command even returns, i.e. before the test captures the offset. The subsequent wait_for_log() calls then searched only from a point after the message had already been written, and timed out waiting for it. Fix by moving the offset capture to before the publisher's transaction is issued, ensuring it always precedes the point where the ERROR can appear in the subscriber log. Reported-by: Alexander Lakhin <exclusion@gmail.com> Author: Zhijie Hou <houzj.fnst@fujitsu.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Backpatch-through: 16, where test was introduced Discussion: https://postgr.es/m/c43753d8-5265-4f77-83ff-9b1167276ec5@gmail.com Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/36ae59dc995bf19b256e410711784ed94c9eedb8 Modified Files -------------- src/test/subscription/t/023_twophase_stream.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2026-08-06 06:17 UTC | newest] Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-05-26 08:29 pgsql: Fix race condition in subscription TAP test 021_twophase Michael Paquier <michael@paquier.xyz> 2025-05-26 08:29 pgsql: Fix race condition in subscription TAP test 021_twophase Michael Paquier <michael@paquier.xyz> 2025-05-26 08:29 pgsql: Fix race condition in subscription TAP test 021_twophase Michael Paquier <michael@paquier.xyz> 2025-05-26 08:29 pgsql: Fix race condition in subscription TAP test 021_twophase Michael Paquier <michael@paquier.xyz> 2026-08-06 06:17 pgsql: Fix race condition in subscription TAP test 023_twophase_stream. Amit Kapila <akapila@postgresql.org> 2026-08-06 06:17 pgsql: Fix race condition in subscription TAP test 023_twophase_stream. Amit Kapila <akapila@postgresql.org> 2026-08-06 06:17 pgsql: Fix race condition in subscription TAP test 023_twophase_stream. Amit Kapila <akapila@postgresql.org> 2026-08-06 06:17 pgsql: Fix race condition in subscription TAP test 023_twophase_stream. Amit Kapila <akapila@postgresql.org> 2026-08-06 06:17 pgsql: Fix race condition in subscription TAP test 023_twophase_stream. Amit Kapila <akapila@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox