Add tests for intermediate results

preventConflictingFlags
Onder Kalaci 2020-04-08 10:47:53 +02:00
parent bd12d90597
commit 1e22bcc8e7
2 changed files with 51 additions and 0 deletions

View File

@ -300,6 +300,34 @@ BEGIN;
16 16
(2 rows) (2 rows)
COMMIT;
BEGIN;
-- now allow at most 1 connection, and ensure that intermediate
-- results don't require any extra connections
SET LOCAL citus.max_adaptive_executor_pool_size TO 1;
SET LOCAL citus.task_assignment_policy TO "round-robin";
SELECT cnt FROM (SELECT count(*) as cnt, random() FROM test LIMIT 1) as foo;
cnt
---------------------------------------------------------------------
101
(1 row)
-- queries with intermediate results don't use any extra connections
SELECT
connection_count_to_node
FROM
citus_remote_connection_stats()
WHERE
port IN (SELECT node_port FROM master_get_active_worker_nodes()) AND
database_name = 'regression'
ORDER BY
hostname, port;
connection_count_to_node
---------------------------------------------------------------------
1
1
(2 rows)
COMMIT; COMMIT;
-- now show that when max_cached_conns_per_worker > 1 -- now show that when max_cached_conns_per_worker > 1
-- Citus forces the first execution to open at least 2 -- Citus forces the first execution to open at least 2

View File

@ -172,6 +172,26 @@ BEGIN;
hostname, port; hostname, port;
COMMIT; COMMIT;
BEGIN;
-- now allow at most 1 connection, and ensure that intermediate
-- results don't require any extra connections
SET LOCAL citus.max_adaptive_executor_pool_size TO 1;
SET LOCAL citus.task_assignment_policy TO "round-robin";
SELECT cnt FROM (SELECT count(*) as cnt, random() FROM test LIMIT 1) as foo;
-- queries with intermediate results don't use any extra connections
SELECT
connection_count_to_node
FROM
citus_remote_connection_stats()
WHERE
port IN (SELECT node_port FROM master_get_active_worker_nodes()) AND
database_name = 'regression'
ORDER BY
hostname, port;
COMMIT;
-- now show that when max_cached_conns_per_worker > 1 -- now show that when max_cached_conns_per_worker > 1
-- Citus forces the first execution to open at least 2 -- Citus forces the first execution to open at least 2
-- connections that are cached. Later, that 2 cached -- connections that are cached. Later, that 2 cached
@ -200,6 +220,9 @@ BEGIN;
hostname, port; hostname, port;
COMMIT; COMMIT;
-- connection_retry_timeout cannot be smaller than node_connection_timeout -- connection_retry_timeout cannot be smaller than node_connection_timeout
SET citus.connection_retry_timeout TO 1000; SET citus.connection_retry_timeout TO 1000;