Stabilize failure test shard IDs

pull/2561/head
Marco Slot 2018-12-19 02:59:10 +01:00
parent 5b9376a7f8
commit 13f4a0ac9f
6 changed files with 20 additions and 12 deletions

View File

@ -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
-------

View File

@ -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;

View File

@ -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
-----------

View File

@ -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;
DROP SCHEMA create_distributed_table_non_empty_failure CASCADE;

View File

@ -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()');

View File

@ -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 (