From eb89c445000171ba8ffefd27103a3f8c8a2662a3 Mon Sep 17 00:00:00 2001 From: Arpan Agrawal Date: Sat, 14 Feb 2026 14:34:04 +0530 Subject: [PATCH 1/3] [#30295, #1872] YSQL: Fix flaky test TestPgRegressPgAsync#testIsolationPgRegress Summary: TBD Test Plan: ./yb_build.sh fastdebug --java-test 'org.yb.pgsql.TestPgRegressPgAsync#testIsolationPgRegress' -n 20 Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D50469 --- .../src/test/isolation/expected/yb.port.async-notify.out | 7 ++++--- .../src/test/isolation/specs/yb.port.async-notify.spec | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/postgres/src/test/isolation/expected/yb.port.async-notify.out b/src/postgres/src/test/isolation/expected/yb.port.async-notify.out index ff75441dd7b7..5d7e1b680cfc 100644 --- a/src/postgres/src/test/isolation/expected/yb.port.async-notify.out +++ b/src/postgres/src/test/isolation/expected/yb.port.async-notify.out @@ -104,10 +104,10 @@ step l2commit: COMMIT; listener2: NOTIFY "c1" with payload "" from notifier step l2stop: UNLISTEN *; -starting permutation: llisten lbegin usage bignotify usage +starting permutation: llisten lbegin lusage bignotify ybempty lusage step llisten: LISTEN c1; LISTEN c2; step lbegin: BEGIN; -step usage: SELECT pg_notification_queue_usage() > 0 AS nonzero; +step lusage: SELECT pg_notification_queue_usage() > 0 AS nonzero; nonzero ------- f @@ -120,7 +120,8 @@ count 1000 (1 row) -step usage: SELECT pg_notification_queue_usage() > 0 AS nonzero; +step ybempty: +step lusage: SELECT pg_notification_queue_usage() > 0 AS nonzero; nonzero ------- t diff --git a/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec b/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec index c821b6e5bd60..db48826bdded 100644 --- a/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec +++ b/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec @@ -31,8 +31,8 @@ step notifys1 { ROLLBACK TO SAVEPOINT s2; COMMIT; } -step usage { SELECT pg_notification_queue_usage() > 0 AS nonzero; } step bignotify { SELECT count(pg_notify('c1', s::text)) FROM generate_series(1, 1000) s; } +step ybempty {} teardown { UNLISTEN *; } # The listener session is used for cross-backend notify checks. @@ -43,6 +43,7 @@ step lcheck { SELECT 1 AS x; } step lbegin { BEGIN; } step lbegins { BEGIN ISOLATION LEVEL SERIALIZABLE; } step lcommit { COMMIT; } +step lusage { SELECT pg_notification_queue_usage() > 0 AS nonzero; } teardown { UNLISTEN *; } # In some tests we need a second listener, just to block the queue. @@ -87,4 +88,4 @@ permutation l2listen l2begin notify1 lbegins llisten lcommit l2commit l2stop # make the output deterministic, add (*) to bignotify to always report it as # waiting. -permutation llisten lbegin usage bignotify(*) usage +permutation llisten lbegin lusage bignotify(*) ybempty lusage \ No newline at end of file From 9a5b0689c6778a78247b1699422bb15470b619a4 Mon Sep 17 00:00:00 2001 From: Arpan Agrawal Date: Mon, 23 Feb 2026 18:20:18 +0530 Subject: [PATCH 2/3] cosmetic changes --- .../test/isolation/expected/yb.port.async-notify.out | 8 ++++---- .../test/isolation/specs/yb.port.async-notify.spec | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/postgres/src/test/isolation/expected/yb.port.async-notify.out b/src/postgres/src/test/isolation/expected/yb.port.async-notify.out index 5d7e1b680cfc..298b7e29eda3 100644 --- a/src/postgres/src/test/isolation/expected/yb.port.async-notify.out +++ b/src/postgres/src/test/isolation/expected/yb.port.async-notify.out @@ -104,10 +104,10 @@ step l2commit: COMMIT; listener2: NOTIFY "c1" with payload "" from notifier step l2stop: UNLISTEN *; -starting permutation: llisten lbegin lusage bignotify ybempty lusage +starting permutation: llisten lbegin yb_lusage bignotify yb_empty yb_lusage step llisten: LISTEN c1; LISTEN c2; step lbegin: BEGIN; -step lusage: SELECT pg_notification_queue_usage() > 0 AS nonzero; +step yb_lusage: SELECT pg_notification_queue_usage() > 0 AS nonzero; nonzero ------- f @@ -120,8 +120,8 @@ count 1000 (1 row) -step ybempty: -step lusage: SELECT pg_notification_queue_usage() > 0 AS nonzero; +step yb_empty: +step yb_lusage: SELECT pg_notification_queue_usage() > 0 AS nonzero; nonzero ------- t diff --git a/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec b/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec index db48826bdded..85220b34c753 100644 --- a/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec +++ b/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec @@ -32,7 +32,7 @@ step notifys1 { COMMIT; } step bignotify { SELECT count(pg_notify('c1', s::text)) FROM generate_series(1, 1000) s; } -step ybempty {} +step yb_empty {} teardown { UNLISTEN *; } # The listener session is used for cross-backend notify checks. @@ -43,7 +43,7 @@ step lcheck { SELECT 1 AS x; } step lbegin { BEGIN; } step lbegins { BEGIN ISOLATION LEVEL SERIALIZABLE; } step lcommit { COMMIT; } -step lusage { SELECT pg_notification_queue_usage() > 0 AS nonzero; } +step yb_lusage { SELECT pg_notification_queue_usage() > 0 AS nonzero; } teardown { UNLISTEN *; } # In some tests we need a second listener, just to block the queue. @@ -82,10 +82,14 @@ permutation l2listen l2begin notify1 lbegins llisten lcommit l2commit l2stop # commit the listener's transaction, so that it never reports these events. # Hence, this should be the last test in this script. -# YB: In YB, any operation taking longer than +# YB: +# In YB, any operation taking longer than # YB_NUM_SECONDS_TO_WAIT_TO_ASSUME_SESSION_BLOCKED is deemed as waiting on the # other session. The step 'bignotify' intermittently breaches this limit. To # make the output deterministic, add (*) to bignotify to always report it as # waiting. +# +# Also, in YB, listener and notifier can be in different nodes. Check queue +# usage on the listening node after bignotify completes. -permutation llisten lbegin lusage bignotify(*) ybempty lusage \ No newline at end of file +permutation llisten lbegin yb_lusage bignotify(*) yb_empty yb_lusage \ No newline at end of file From ce8e2856266f9004187e19ee3586f2bffb4e05b2 Mon Sep 17 00:00:00 2001 From: Arpan Agrawal Date: Mon, 23 Feb 2026 18:21:54 +0530 Subject: [PATCH 3/3] newline --- src/postgres/src/test/isolation/specs/yb.port.async-notify.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec b/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec index 85220b34c753..760c3d1f0f99 100644 --- a/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec +++ b/src/postgres/src/test/isolation/specs/yb.port.async-notify.spec @@ -92,4 +92,4 @@ permutation l2listen l2begin notify1 lbegins llisten lcommit l2commit l2stop # Also, in YB, listener and notifier can be in different nodes. Check queue # usage on the listening node after bignotify completes. -permutation llisten lbegin yb_lusage bignotify(*) yb_empty yb_lusage \ No newline at end of file +permutation llisten lbegin yb_lusage bignotify(*) yb_empty yb_lusage