From 1b5ed45a58ec350d1be9635e46619fa6a5af17f7 Mon Sep 17 00:00:00 2001 From: Sait Talha Nisanci Date: Mon, 13 Jul 2020 19:37:17 +0300 Subject: [PATCH] add multi follower repartition tests --- .../multi_follower_select_statements.out | 23 +++++++++++++++++++ .../sql/multi_follower_select_statements.sql | 15 ++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/test/regress/expected/multi_follower_select_statements.out b/src/test/regress/expected/multi_follower_select_statements.out index 3f4340d61..73ce25895 100644 --- a/src/test/regress/expected/multi_follower_select_statements.out +++ b/src/test/regress/expected/multi_follower_select_statements.out @@ -33,6 +33,21 @@ SELECT create_distributed_table('stock','s_w_id'); (1 row) INSERT INTO stock SELECT c, c, c FROM generate_series(1, 5) as c; +SET citus.enable_repartition_joins TO ON; +SELECT count(*) FROM the_table t1 JOIN the_table t2 USING(b); + count +--------------------------------------------------------------------- + 2 +(1 row) + +SET citus.enable_single_hash_repartition_joins TO ON; +SELECT count(*) FROM the_table t1 , the_table t2 WHERE t1.a = t2.b; + count +--------------------------------------------------------------------- + 2 +(1 row) + +RESET citus.enable_repartition_joins; -- connect to the follower and check that a simple select query works, the follower -- is still in the default cluster and will send queries to the primary nodes \c - - - :follower_master_port @@ -100,6 +115,14 @@ order by s_i_id; 5 | 5 (3 rows) +SET citus.enable_repartition_joins TO ON; +SELECT count(*) FROM the_table t1 JOIN the_table t2 USING(b); +ERROR: writing to worker nodes is not currently allowed +DETAIL: the database is read-only +SET citus.enable_single_hash_repartition_joins TO ON; +SELECT count(*) FROM the_table t1 , the_table t2 WHERE t1.a = t2.b; +ERROR: writing to worker nodes is not currently allowed +DETAIL: the database is read-only SELECT node_name, node_port FROM diff --git a/src/test/regress/sql/multi_follower_select_statements.sql b/src/test/regress/sql/multi_follower_select_statements.sql index 9fa8dc8ba..436b08cda 100644 --- a/src/test/regress/sql/multi_follower_select_statements.sql +++ b/src/test/regress/sql/multi_follower_select_statements.sql @@ -21,6 +21,14 @@ SELECT create_distributed_table('stock','s_w_id'); INSERT INTO stock SELECT c, c, c FROM generate_series(1, 5) as c; +SET citus.enable_repartition_joins TO ON; +SELECT count(*) FROM the_table t1 JOIN the_table t2 USING(b); + +SET citus.enable_single_hash_repartition_joins TO ON; + +SELECT count(*) FROM the_table t1 , the_table t2 WHERE t1.a = t2.b; +RESET citus.enable_repartition_joins; + -- connect to the follower and check that a simple select query works, the follower -- is still in the default cluster and will send queries to the primary nodes @@ -66,6 +74,13 @@ group by s_i_id having sum(s_order_cnt) > (select max(s_order_cnt) - 3 as having_query from stock) order by s_i_id; +SET citus.enable_repartition_joins TO ON; +SELECT count(*) FROM the_table t1 JOIN the_table t2 USING(b); + +SET citus.enable_single_hash_repartition_joins TO ON; + +SELECT count(*) FROM the_table t1 , the_table t2 WHERE t1.a = t2.b; + SELECT node_name, node_port