From 1ba399f5cacacab13c0b710274bd93b2130227be Mon Sep 17 00:00:00 2001 From: SaitTalhaNisanci Date: Thu, 28 Jan 2021 18:42:49 +0300 Subject: [PATCH] Fix a flaky behaviour in shared_connection_stats (#4596) With the previous query, we were not pushing down the pg_sleep hence the number of connections to a worker could be different from run to run. --- src/test/regress/expected/shared_connection_stats.out | 6 +++--- src/test/regress/sql/shared_connection_stats.sql | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/regress/expected/shared_connection_stats.out b/src/test/regress/expected/shared_connection_stats.out index 49cc8ef1f..68be0f760 100644 --- a/src/test/regress/expected/shared_connection_stats.out +++ b/src/test/regress/expected/shared_connection_stats.out @@ -227,10 +227,10 @@ COMMIT; -- and only 5 connections are used per node BEGIN; SET LOCAL citus.max_adaptive_executor_pool_size TO 16; - SELECT count(*), pg_sleep(0.1) FROM test; - count | pg_sleep + with cte_1 as (select pg_sleep(0.1) is null, a from test) SELECT a from cte_1 ORDER By 1 LIMIT 1; + a --------------------------------------------------------------------- - 101 | + 0 (1 row) SELECT diff --git a/src/test/regress/sql/shared_connection_stats.sql b/src/test/regress/sql/shared_connection_stats.sql index bd11f55fe..1aa904ff2 100644 --- a/src/test/regress/sql/shared_connection_stats.sql +++ b/src/test/regress/sql/shared_connection_stats.sql @@ -149,7 +149,7 @@ COMMIT; -- and only 5 connections are used per node BEGIN; SET LOCAL citus.max_adaptive_executor_pool_size TO 16; - SELECT count(*), pg_sleep(0.1) FROM test; + with cte_1 as (select pg_sleep(0.1) is null, a from test) SELECT a from cte_1 ORDER By 1 LIMIT 1; SELECT connection_count_to_node FROM