From 3584fa11b0b606356c002e89ad1e2d1e3b718339 Mon Sep 17 00:00:00 2001 From: Sait Talha Nisanci Date: Thu, 28 Jan 2021 15:08:16 +0300 Subject: [PATCH] Fix a flaky behaviour in shared_connection_stats 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 | 7 ++++--- src/test/regress/sql/shared_connection_stats.sql | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/test/regress/expected/shared_connection_stats.out b/src/test/regress/expected/shared_connection_stats.out index 04876601f..75dae952e 100644 --- a/src/test/regress/expected/shared_connection_stats.out +++ b/src/test/regress/expected/shared_connection_stats.out @@ -226,10 +226,11 @@ COMMIT; -- now, some of the optional connections would be skipped, -- and only 5 connections are used per node BEGIN; - SELECT count(*), pg_sleep(0.1) FROM test; - count | pg_sleep + SET LOCAL citus.max_adaptive_executor_pool_size TO 16; + 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 45a89ebb0..5077c90c6 100644 --- a/src/test/regress/sql/shared_connection_stats.sql +++ b/src/test/regress/sql/shared_connection_stats.sql @@ -148,7 +148,8 @@ COMMIT; -- now, some of the optional connections would be skipped, -- and only 5 connections are used per node BEGIN; - SELECT count(*), pg_sleep(0.1) FROM test; + SET LOCAL citus.max_adaptive_executor_pool_size TO 16; + 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