From 13f4a0ac9f4cd4e291a8620a3e782ce3293c4061 Mon Sep 17 00:00:00 2001 From: Marco Slot Date: Wed, 19 Dec 2018 02:59:10 +0100 Subject: [PATCH] Stabilize failure test shard IDs --- .../failure_create_distributed_table_non_empty.out | 5 +++-- .../expected/failure_create_reference_table.out | 13 +++++++------ src/test/regress/expected/failure_cte_subquery.out | 3 ++- .../failure_create_distributed_table_non_empty.sql | 4 +++- .../regress/sql/failure_create_reference_table.sql | 4 +++- src/test/regress/sql/failure_cte_subquery.sql | 3 ++- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/test/regress/expected/failure_create_distributed_table_non_empty.out b/src/test/regress/expected/failure_create_distributed_table_non_empty.out index a5135271c..794db86aa 100644 --- a/src/test/regress/expected/failure_create_distributed_table_non_empty.out +++ b/src/test/regress/expected/failure_create_distributed_table_non_empty.out @@ -3,6 +3,7 @@ -- CREATE SCHEMA create_distributed_table_non_empty_failure; SET search_path TO 'create_distributed_table_non_empty_failure'; +SET citus.next_shard_id TO 11000000; SELECT citus.mitmproxy('conn.allow()'); mitmproxy ----------- @@ -219,7 +220,7 @@ SELECT citus.mitmproxy('conn.onCommandComplete(command="COPY").kill()'); SELECT create_distributed_table('test_table', 'id'); NOTICE: Copying data from local table... -ERROR: failed to COPY to shard 102052 on localhost:9060 +ERROR: failed to COPY to shard 11000016 on localhost:9060 SELECT count(*) FROM pg_dist_shard WHERE logicalrelid='create_distributed_table_non_empty_failure.test_table'::regclass; count ------- @@ -738,7 +739,7 @@ SELECT citus.mitmproxy('conn.onCommandComplete(command="COPY").kill()'); (1 row) SELECT create_distributed_table('test_table', 'id'); -ERROR: failed to COPY to shard 102132 on localhost:9060 +ERROR: failed to COPY to shard 11000096 on localhost:9060 SELECT count(*) FROM pg_dist_shard WHERE logicalrelid='create_distributed_table_non_empty_failure.test_table'::regclass; count ------- diff --git a/src/test/regress/expected/failure_create_reference_table.out b/src/test/regress/expected/failure_create_reference_table.out index ca253a4de..9e5af1961 100644 --- a/src/test/regress/expected/failure_create_reference_table.out +++ b/src/test/regress/expected/failure_create_reference_table.out @@ -3,6 +3,7 @@ -- CREATE SCHEMA failure_reference_table; SET search_path TO 'failure_reference_table'; +SET citus.next_shard_id TO 10000000; SELECT citus.mitmproxy('conn.allow()'); mitmproxy ----------- @@ -105,7 +106,7 @@ SELECT citus.mitmproxy('conn.onCommandComplete(command="COPY 3").kill()'); SELECT create_reference_table('ref_table'); NOTICE: Copying data from local table... -ERROR: failed to COPY to shard 102030 on localhost:9060 +ERROR: failed to COPY to shard 10000004 on localhost:9060 SELECT count(*) FROM pg_dist_shard_placement; count ------- @@ -166,11 +167,11 @@ SELECT create_reference_table('ref_table'); (1 row) -SELECT * FROM pg_dist_shard_placement ORDER BY shardid, nodeport; - shardid | shardstate | shardlength | nodename | nodeport | placementid ----------+------------+-------------+-----------+----------+------------- - 102033 | 1 | 0 | localhost | 9060 | 123 - 102033 | 1 | 0 | localhost | 57637 | 124 +SELECT shardid, nodeport, shardstate FROM pg_dist_shard_placement ORDER BY shardid, nodeport; + shardid | nodeport | shardstate +----------+----------+------------ + 10000007 | 9060 | 1 + 10000007 | 57637 | 1 (2 rows) SET client_min_messages TO NOTICE; diff --git a/src/test/regress/expected/failure_cte_subquery.out b/src/test/regress/expected/failure_cte_subquery.out index 5a8b9737d..e955a4b9d 100644 --- a/src/test/regress/expected/failure_cte_subquery.out +++ b/src/test/regress/expected/failure_cte_subquery.out @@ -2,6 +2,7 @@ CREATE SCHEMA cte_failure; SET SEARCH_PATH=cte_failure; SET citus.shard_count to 2; SET citus.shard_replication_factor to 1; +SET citus.next_shard_id TO 16000000; SELECT pg_backend_pid() as pid \gset CREATE TABLE users_table (user_id int, user_name text); CREATE TABLE events_table(user_id int, event_id int, event_type int); @@ -53,7 +54,7 @@ ERROR: server closed the connection unexpectedly before or while processing the request. CONTEXT: while executing command on localhost:9060 -- kill at the second copy (pull) -SELECT citus.mitmproxy('conn.onQuery(query="SELECT user_id FROM cte_failure.events_table_102250").kill()'); +SELECT citus.mitmproxy('conn.onQuery(query="SELECT user_id FROM cte_failure.events_table_16000002").kill()'); mitmproxy ----------- diff --git a/src/test/regress/sql/failure_create_distributed_table_non_empty.sql b/src/test/regress/sql/failure_create_distributed_table_non_empty.sql index ca0acb74c..46dbadcc8 100644 --- a/src/test/regress/sql/failure_create_distributed_table_non_empty.sql +++ b/src/test/regress/sql/failure_create_distributed_table_non_empty.sql @@ -4,6 +4,8 @@ CREATE SCHEMA create_distributed_table_non_empty_failure; SET search_path TO 'create_distributed_table_non_empty_failure'; +SET citus.next_shard_id TO 11000000; + SELECT citus.mitmproxy('conn.allow()'); -- we'll start with replication factor 1 and 2pc @@ -329,4 +331,4 @@ SELECT count(*) FROM pg_dist_shard WHERE logicalrelid='create_distributed_table_ SELECT run_command_on_workers($$SELECT count(*) FROM information_schema.tables WHERE table_schema = 'create_distributed_table_non_empty_failure' and table_name LIKE 'test_table%'$$); SELECT citus.mitmproxy('conn.allow()'); -DROP SCHEMA create_distributed_table_non_empty_failure CASCADE; \ No newline at end of file +DROP SCHEMA create_distributed_table_non_empty_failure CASCADE; diff --git a/src/test/regress/sql/failure_create_reference_table.sql b/src/test/regress/sql/failure_create_reference_table.sql index 1d92ce868..0e8176520 100644 --- a/src/test/regress/sql/failure_create_reference_table.sql +++ b/src/test/regress/sql/failure_create_reference_table.sql @@ -5,6 +5,8 @@ CREATE SCHEMA failure_reference_table; SET search_path TO 'failure_reference_table'; +SET citus.next_shard_id TO 10000000; + SELECT citus.mitmproxy('conn.allow()'); CREATE TABLE ref_table(id int); @@ -68,7 +70,7 @@ SELECT recover_prepared_transactions(); SELECT citus.mitmproxy('conn.onCommandComplete(command="COMMIT PREPARED").kill()'); SELECT create_reference_table('ref_table'); -SELECT * FROM pg_dist_shard_placement ORDER BY shardid, nodeport; +SELECT shardid, nodeport, shardstate FROM pg_dist_shard_placement ORDER BY shardid, nodeport; SET client_min_messages TO NOTICE; SELECT citus.mitmproxy('conn.allow()'); diff --git a/src/test/regress/sql/failure_cte_subquery.sql b/src/test/regress/sql/failure_cte_subquery.sql index 502ef0e28..6bb6751cf 100644 --- a/src/test/regress/sql/failure_cte_subquery.sql +++ b/src/test/regress/sql/failure_cte_subquery.sql @@ -3,6 +3,7 @@ CREATE SCHEMA cte_failure; SET SEARCH_PATH=cte_failure; SET citus.shard_count to 2; SET citus.shard_replication_factor to 1; +SET citus.next_shard_id TO 16000000; SELECT pg_backend_pid() as pid \gset @@ -40,7 +41,7 @@ FROM WHERE foo.user_id = cte.user_id; -- kill at the second copy (pull) -SELECT citus.mitmproxy('conn.onQuery(query="SELECT user_id FROM cte_failure.events_table_102250").kill()'); +SELECT citus.mitmproxy('conn.onQuery(query="SELECT user_id FROM cte_failure.events_table_16000002").kill()'); WITH cte AS ( WITH local_cte AS (