Fix tests

guc_for_replicate_on_activate
Hadi Moshayedi 2020-04-02 16:11:39 -07:00
parent 7d7f9eef7a
commit 8dfd342047
13 changed files with 220 additions and 492 deletions

View File

@ -75,25 +75,6 @@ ORDER BY placementid;
200000 | 1
(1 row)
-- fail activate node by failing reference table creation
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE").kill()');
mitmproxy
---------------------------------------------------------------------
(1 row)
SELECT master_activate_node('localhost', :worker_2_proxy_port);
NOTICE: Replicating reference table "user_table" to the node localhost:xxxxx
ERROR: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
CONTEXT: while executing command on localhost:xxxxx
SELECT citus.mitmproxy('conn.allow()');
mitmproxy
---------------------------------------------------------------------
(1 row)
-- verify node is not activated
SELECT * FROM master_get_active_worker_nodes()
ORDER BY 1, 2;
@ -140,39 +121,6 @@ ORDER BY placementid;
200000 | 1
(1 row)
-- fail activate node by failing reference table creation
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE").cancel(' || pg_backend_pid() || ')');
mitmproxy
---------------------------------------------------------------------
(1 row)
SELECT master_activate_node('localhost', :worker_2_proxy_port);
NOTICE: Replicating reference table "user_table" to the node localhost:xxxxx
ERROR: canceling statement due to user request
-- verify node is not activated
SELECT * FROM master_get_active_worker_nodes()
ORDER BY 1, 2;
node_name | node_port
---------------------------------------------------------------------
localhost | 57637
(1 row)
SELECT shardid, shardstate
FROM pg_dist_placement p JOIN pg_dist_shard s USING (shardid)
WHERE s.logicalrelid = 'user_table'::regclass
ORDER BY placementid;
shardid | shardstate
---------------------------------------------------------------------
200000 | 1
(1 row)
SELECT citus.mitmproxy('conn.allow()');
mitmproxy
---------------------------------------------------------------------
(1 row)
-- master_remove_node fails when there are shards on that worker
SELECT master_remove_node('localhost', :worker_2_proxy_port);
ERROR: you cannot remove the primary node of a node group which has shard placements
@ -225,63 +173,6 @@ ORDER BY placementid;
200000 | 1
(1 row)
-- test master_add_node replicated a reference table
-- to newly added node.
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE").kill()');
mitmproxy
---------------------------------------------------------------------
(1 row)
SELECT master_add_node('localhost', :worker_2_proxy_port);
NOTICE: Replicating reference table "user_table" to the node localhost:xxxxx
ERROR: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
CONTEXT: while executing command on localhost:xxxxx
-- verify node is not added
SELECT * FROM master_get_active_worker_nodes()
ORDER BY 1, 2;
node_name | node_port
---------------------------------------------------------------------
localhost | 57637
(1 row)
SELECT shardid, shardstate
FROM pg_dist_placement p JOIN pg_dist_shard s USING (shardid)
WHERE s.logicalrelid = 'user_table'::regclass
ORDER BY placementid;
shardid | shardstate
---------------------------------------------------------------------
200000 | 1
(1 row)
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE").cancel(' || pg_backend_pid() || ')');
mitmproxy
---------------------------------------------------------------------
(1 row)
SELECT master_add_node('localhost', :worker_2_proxy_port);
NOTICE: Replicating reference table "user_table" to the node localhost:xxxxx
ERROR: canceling statement due to user request
-- verify node is not added
SELECT * FROM master_get_active_worker_nodes()
ORDER BY 1, 2;
node_name | node_port
---------------------------------------------------------------------
localhost | 57637
(1 row)
SELECT shardid, shardstate
FROM pg_dist_placement p JOIN pg_dist_shard s USING (shardid)
WHERE s.logicalrelid = 'user_table'::regclass
ORDER BY placementid;
shardid | shardstate
---------------------------------------------------------------------
200000 | 1
(1 row)
-- reset cluster to original state
SELECT citus.mitmproxy('conn.allow()');
mitmproxy
@ -290,10 +181,9 @@ SELECT citus.mitmproxy('conn.allow()');
(1 row)
SELECT master_add_node('localhost', :worker_2_proxy_port);
NOTICE: Replicating reference table "user_table" to the node localhost:xxxxx
master_add_node
---------------------------------------------------------------------
6
4
(1 row)
-- verify node is added
@ -312,32 +202,6 @@ ORDER BY placementid;
shardid | shardstate
---------------------------------------------------------------------
200000 | 1
200000 | 1
(2 rows)
-- fail master_add_node by failing copy out operation
SELECT master_remove_node('localhost', :worker_1_port);
master_remove_node
---------------------------------------------------------------------
(1 row)
SELECT citus.mitmproxy('conn.onQuery(query="COPY").kill()');
mitmproxy
---------------------------------------------------------------------
(1 row)
SELECT master_add_node('localhost', :worker_1_port);
NOTICE: Replicating reference table "user_table" to the node localhost:xxxxx
ERROR: could not copy table "user_table_200000" from "localhost:xxxxx"
CONTEXT: while executing command on localhost:xxxxx
-- verify node is not added
SELECT * FROM master_get_active_worker_nodes()
ORDER BY 1, 2;
node_name | node_port
---------------------------------------------------------------------
localhost | 9060
(1 row)
SELECT citus.mitmproxy('conn.allow()');
@ -347,10 +211,9 @@ SELECT citus.mitmproxy('conn.allow()');
(1 row)
SELECT master_add_node('localhost', :worker_1_port);
NOTICE: Replicating reference table "user_table" to the node localhost:xxxxx
master_add_node
---------------------------------------------------------------------
8
1
(1 row)
-- verify node is added
@ -369,8 +232,7 @@ ORDER BY placementid;
shardid | shardstate
---------------------------------------------------------------------
200000 | 1
200000 | 1
(2 rows)
(1 row)
RESET SEARCH_PATH;
DROP SCHEMA add_remove_node CASCADE;

View File

@ -1122,7 +1122,6 @@ ON CONFLICT(c1, c2, c3, c4, c5, c6)
DO UPDATE SET
cardinality = enriched.cardinality + excluded.cardinality,
sum = enriched.sum + excluded.sum;
DEBUG: rehashing catalog cache id 14 for pg_opclass; 17 tups, 8 buckets at character 224
DEBUG: INSERT target table and the source relation of the SELECT partition column value must be colocated in distributed INSERT ... SELECT
DEBUG: Router planner cannot handle multi-shard select queries
DEBUG: performing repartitioned INSERT ... SELECT

View File

@ -18,11 +18,10 @@ step s1-add-second-worker:
1
step s2-copy-to-reference-table:
COPY test_reference_table FROM PROGRAM 'echo 1 && echo 2 && echo 3 && echo 4 && echo 5';
<waiting ...>
step s1-commit:
COMMIT;
step s2-copy-to-reference-table: <... completed>
step s2-print-content:
SELECT
nodeport, success, result
@ -34,7 +33,6 @@ step s2-print-content:
nodeport success result
57637 t 10
57638 t 10
master_remove_node
@ -55,14 +53,13 @@ step s2-copy-to-reference-table:
step s1-add-second-worker:
SELECT 1 FROM master_add_node('localhost', 57638);
<waiting ...>
step s2-commit:
COMMIT;
step s1-add-second-worker: <... completed>
?column?
1
step s2-commit:
COMMIT;
step s2-print-content:
SELECT
nodeport, success, result
@ -74,7 +71,6 @@ step s2-print-content:
nodeport success result
57637 t 10
57638 t 10
master_remove_node
@ -98,11 +94,10 @@ step s1-add-second-worker:
1
step s2-insert-to-reference-table:
INSERT INTO test_reference_table VALUES (6);
<waiting ...>
step s1-commit:
COMMIT;
step s2-insert-to-reference-table: <... completed>
step s2-print-content:
SELECT
nodeport, success, result
@ -114,7 +109,6 @@ step s2-print-content:
nodeport success result
57637 t 6
57638 t 6
master_remove_node
@ -135,14 +129,13 @@ step s2-insert-to-reference-table:
step s1-add-second-worker:
SELECT 1 FROM master_add_node('localhost', 57638);
<waiting ...>
step s2-commit:
COMMIT;
step s1-add-second-worker: <... completed>
?column?
1
step s2-commit:
COMMIT;
step s2-print-content:
SELECT
nodeport, success, result
@ -154,7 +147,6 @@ step s2-print-content:
nodeport success result
57637 t 6
57638 t 6
master_remove_node
@ -194,7 +186,6 @@ step s2-print-index-count:
nodeport success result
57637 t 1
57638 t 1
master_remove_node
@ -234,7 +225,6 @@ step s2-print-index-count:
nodeport success result
57637 t 1
57638 t 1
master_remove_node
@ -320,7 +310,6 @@ step s2-print-content-2:
nodeport success result
57637 t 1
57638 t 1
master_remove_node
@ -341,11 +330,10 @@ step s1-add-second-worker:
1
step s2-copy-to-reference-table:
COPY test_reference_table FROM PROGRAM 'echo 1 && echo 2 && echo 3 && echo 4 && echo 5';
<waiting ...>
step s1-commit:
COMMIT;
step s2-copy-to-reference-table: <... completed>
step s2-print-content:
SELECT
nodeport, success, result
@ -357,7 +345,6 @@ step s2-print-content:
nodeport success result
57637 t 5
57638 t 5
master_remove_node
@ -375,14 +362,13 @@ step s2-copy-to-reference-table:
step s1-add-second-worker:
SELECT 1 FROM master_add_node('localhost', 57638);
<waiting ...>
step s2-commit:
COMMIT;
step s1-add-second-worker: <... completed>
?column?
1
step s2-commit:
COMMIT;
step s2-print-content:
SELECT
nodeport, success, result
@ -394,7 +380,6 @@ step s2-print-content:
nodeport success result
57637 t 5
57638 t 5
master_remove_node
@ -415,11 +400,10 @@ step s1-add-second-worker:
1
step s2-insert-to-reference-table:
INSERT INTO test_reference_table VALUES (6);
<waiting ...>
step s1-commit:
COMMIT;
step s2-insert-to-reference-table: <... completed>
step s2-print-content:
SELECT
nodeport, success, result
@ -431,7 +415,6 @@ step s2-print-content:
nodeport success result
57637 t 1
57638 t 1
master_remove_node
@ -449,14 +432,13 @@ step s2-insert-to-reference-table:
step s1-add-second-worker:
SELECT 1 FROM master_add_node('localhost', 57638);
<waiting ...>
step s2-commit:
COMMIT;
step s1-add-second-worker: <... completed>
?column?
1
step s2-commit:
COMMIT;
step s2-print-content:
SELECT
nodeport, success, result
@ -468,7 +450,6 @@ step s2-print-content:
nodeport success result
57637 t 1
57638 t 1
master_remove_node
@ -505,7 +486,6 @@ step s2-print-index-count:
nodeport success result
57637 t 1
57638 t 1
master_remove_node
@ -542,7 +522,6 @@ step s2-print-index-count:
nodeport success result
57637 t 1
57638 t 1
master_remove_node
@ -622,7 +601,6 @@ step s2-print-content-2:
nodeport success result
57637 t 1
57638 t 1
master_remove_node

View File

@ -15,10 +15,6 @@ DEBUG: schema "citus_mx_test_schema_join_2" already exists, skipping
DETAIL: NOTICE from localhost:xxxxx
DEBUG: schema "citus_mx_schema_for_xacts" already exists, skipping
DETAIL: NOTICE from localhost:xxxxx
NOTICE: Replicating reference table "customer_mx" to the node localhost:xxxxx
NOTICE: Replicating reference table "nation_mx" to the node localhost:xxxxx
NOTICE: Replicating reference table "part_mx" to the node localhost:xxxxx
NOTICE: Replicating reference table "supplier_mx" to the node localhost:xxxxx
master_add_node
---------------------------------------------------------------------
32

View File

@ -1394,7 +1394,6 @@ WHERE logicalrelid='mx_ref'::regclass;
\c - - - :master_port
SELECT master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "mx_ref" to the node localhost:xxxxx
master_add_node
---------------------------------------------------------------------
7
@ -1407,8 +1406,7 @@ ORDER BY shardid, nodeport;
shardid | nodename | nodeport
---------------------------------------------------------------------
1310073 | localhost | 57637
1310073 | localhost | 57638
(2 rows)
(1 row)
\c - - - :worker_1_port
SELECT shardid, nodename, nodeport
@ -1418,8 +1416,7 @@ ORDER BY shardid, nodeport;
shardid | nodename | nodeport
---------------------------------------------------------------------
1310073 | localhost | 57637
1310073 | localhost | 57638
(2 rows)
(1 row)
-- Get the metadata back into a consistent state
\c - - - :master_port

View File

@ -173,7 +173,6 @@ SELECT nodeid, hasmetadata, metadatasynced FROM pg_dist_node;
-- Test updating a node when another node is in readonly-mode
---------------------------------------------------------------------
SELECT master_add_node('localhost', :worker_2_port) AS nodeid_2 \gset
NOTICE: Replicating reference table "ref_table" to the node localhost:xxxxx
SELECT 1 FROM start_metadata_sync_to_node('localhost', :worker_2_port);
?column?
---------------------------------------------------------------------
@ -383,7 +382,6 @@ SELECT verify_metadata('localhost', :worker_1_port);
(1 row)
SELECT 1 FROM master_activate_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "ref_table" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -449,7 +447,6 @@ SELECT wait_until_metadata_sync();
(1 row)
SELECT 1 FROM master_activate_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "ref_table" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -511,7 +508,6 @@ SELECT wait_until_metadata_sync();
(1 row)
SELECT 1 FROM master_activate_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "ref_table" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1

View File

@ -221,7 +221,6 @@ SELECT master_remove_node('localhost', :worker_2_port);
ERROR: node at "localhost:xxxxx" does not exist
-- re-add the node for next tests
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -242,7 +241,6 @@ SELECT master_remove_node('localhost', :worker_2_port);
-- re-add the node for the next test
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -264,8 +262,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
SELECT *
FROM pg_dist_colocation
@ -293,8 +290,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
\c - - - :master_port
BEGIN;
@ -320,8 +316,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
SELECT *
FROM pg_dist_colocation
@ -349,8 +344,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
\c - - - :master_port
-- remove node in a transaction and COMMIT
@ -369,8 +363,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
SELECT *
FROM pg_dist_colocation
@ -398,8 +391,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
\c - - - :master_port
BEGIN;
@ -458,7 +450,6 @@ WHERE
\c - - - :master_port
-- re-add the node for next tests
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -480,8 +471,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
SELECT *
FROM pg_dist_colocation
@ -509,8 +499,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
\c - - - :master_port
BEGIN;
@ -583,7 +572,6 @@ SELECT * FROM remove_node_reference_table;
\c - - - :master_port
-- re-add the node for next tests
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -605,8 +593,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
SELECT *
FROM pg_dist_colocation
@ -634,8 +621,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
\c - - - :master_port
BEGIN;
@ -704,7 +690,6 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.remove_
-- re-add the node for next tests
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -726,8 +711,7 @@ WHERE
nodeport = :worker_2_port;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380000 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
SELECT *
FROM pg_dist_colocation
@ -903,8 +887,6 @@ WHERE
\c - - - :master_port
-- re-add the node for next tests
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:xxxxx
NOTICE: Replicating reference table "table1" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -928,9 +910,7 @@ ORDER BY
shardid;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380001 | 1 | 0 | localhost | 57638
1380002 | 1 | 0 | localhost | 57638
(2 rows)
(0 rows)
SELECT *
FROM pg_dist_colocation
@ -959,9 +939,7 @@ WHERE
ORDER BY shardid ASC;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1380001 | 1 | 0 | localhost | 57638
1380002 | 1 | 0 | localhost | 57638
(2 rows)
(0 rows)
\c - - - :master_port
SELECT master_disable_node('localhost', :worker_2_port);
@ -1018,8 +996,6 @@ WHERE
\c - - - :master_port
-- re-add the node for next tests
SELECT 1 FROM master_activate_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:xxxxx
NOTICE: Replicating reference table "table1" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1

View File

@ -70,12 +70,16 @@ SELECT create_reference_table('replicate_reference_table_unhealthy');
UPDATE pg_dist_shard_placement SET shardstate = 3 WHERE shardid = 1370000;
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
ERROR: could not find any healthy placement for shard xxxxx
?column?
---------------------------------------------------------------------
1
(1 row)
-- verify node is not added
SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
count
---------------------------------------------------------------------
0
1
(1 row)
-- verify nothing is replicated to the new node
@ -108,7 +112,8 @@ WHERE
ORDER BY shardid, nodeport;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
(0 rows)
1370001 | 1 | 0 | localhost | 57638
(1 row)
SELECT *
FROM pg_dist_colocation
@ -122,7 +127,6 @@ WHERE colocationid IN
(1 row)
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_valid" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -247,7 +251,6 @@ WHERE colocationid IN
BEGIN;
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_rollback" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -311,7 +314,6 @@ WHERE colocationid IN
BEGIN;
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_commit" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -328,8 +330,7 @@ WHERE
ORDER BY shardid, nodeport;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1370003 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
SELECT *
FROM pg_dist_colocation
@ -406,8 +407,7 @@ ORDER BY logicalrelid;
replicate_reference_table_hash | h | f | c
(2 rows)
BEGIN;
SET LOCAL client_min_messages TO ERROR;
SET client_min_messages TO WARNING;
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
?column?
---------------------------------------------------------------------
@ -426,7 +426,7 @@ SELECT create_reference_table('replicate_reference_table_reference_two');
(1 row)
COMMIT;
RESET client_min_messages;
-- status after master_add_node
SELECT
shardid, shardstate, shardlength, nodename, nodeport
@ -554,7 +554,6 @@ WHERE colocationid IN
BEGIN;
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_drop" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -618,7 +617,6 @@ WHERE colocationid IN
(1 row)
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "table1" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -634,8 +632,7 @@ WHERE
ORDER BY shardid, nodeport;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1370011 | 1 | 0 | localhost | 57638
(1 row)
(0 rows)
SELECT *
FROM pg_dist_colocation
@ -681,9 +678,6 @@ ORDER BY shardid, nodeport;
(0 rows)
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "ref_table_1" to the node localhost:xxxxx
NOTICE: Replicating reference table "ref_table_2" to the node localhost:xxxxx
NOTICE: Replicating reference table "ref_table_3" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -699,17 +693,14 @@ WHERE
ORDER BY shardid, nodeport;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1370012 | 1 | 0 | localhost | 57638
1370013 | 1 | 0 | localhost | 57638
1370014 | 1 | 0 | localhost | 57638
(3 rows)
(0 rows)
-- verify constraints have been created on the new node
SELECT run_command_on_workers('select count(*) from pg_constraint where contype=''f'' AND conname like ''ref_table%'';');
run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,2)
(localhost,57638,t,2)
(localhost,57638,t,0)
(2 rows)
DROP TABLE ref_table_1, ref_table_2, ref_table_3;
@ -754,7 +745,6 @@ ORDER BY 1,4,5;
-- we should see the two shard placements after activation
SELECT 1 FROM master_activate_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "initially_not_replicated_reference_table" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1
@ -776,8 +766,7 @@ ORDER BY 1,4,5;
shardid | shardstate | shardlength | nodename | nodeport
---------------------------------------------------------------------
1370015 | 1 | 0 | localhost | 57637
1370015 | 1 | 0 | localhost | 57638
(2 rows)
(1 row)
-- this should have no effect
SELECT 1 FROM master_add_node('localhost', :worker_2_port);

View File

@ -655,7 +655,6 @@ ORDER BY
\c - - - :master_port
-- try using the coordinator as a worker and then dropping the table
SELECT 1 FROM master_add_node('localhost', :master_port);
NOTICE: Replicating reference table "transactional_drop_reference" to the node localhost:xxxxx
?column?
---------------------------------------------------------------------
1

View File

@ -502,7 +502,9 @@ SELECT shardid, nodename, nodeport
WHERE logicalrelid = 'numbers_append'::regclass order by placementid;
-- add the node back
SET client_min_messages TO ERROR;
SELECT 1 FROM master_activate_node('localhost', :worker_1_port);
RESET client_min_messages;
RESET citus.shard_replication_factor;
-- add two new shards and verify they are created at both workers
COPY numbers_append FROM STDIN WITH (FORMAT 'csv');

View File

@ -674,19 +674,14 @@ SELECT shardid, nodename, nodeport
(4 rows)
-- add the node back
SET client_min_messages TO ERROR;
SELECT 1 FROM master_activate_node('localhost', :worker_1_port);
NOTICE: Replicating reference table "orders_reference" to the node localhost:57637
NOTICE: Replicating reference table "customer" to the node localhost:57637
NOTICE: Replicating reference table "nation" to the node localhost:57637
NOTICE: Replicating reference table "part" to the node localhost:57637
NOTICE: Replicating reference table "supplier" to the node localhost:57637
NOTICE: Replicating reference table "multi_outer_join_right_reference" to the node localhost:57637
NOTICE: Replicating reference table "multi_outer_join_third_reference" to the node localhost:57637
?column?
----------
1
(1 row)
RESET client_min_messages;
RESET citus.shard_replication_factor;
-- add two new shards and verify they are created at both workers
COPY numbers_append FROM STDIN WITH (FORMAT 'csv');

View File

@ -39,13 +39,6 @@ FROM pg_dist_placement p JOIN pg_dist_shard s USING (shardid)
WHERE s.logicalrelid = 'user_table'::regclass
ORDER BY placementid;
-- fail activate node by failing reference table creation
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE").kill()');
SELECT master_activate_node('localhost', :worker_2_proxy_port);
SELECT citus.mitmproxy('conn.allow()');
-- verify node is not activated
SELECT * FROM master_get_active_worker_nodes()
ORDER BY 1, 2;
@ -69,22 +62,6 @@ FROM pg_dist_placement p JOIN pg_dist_shard s USING (shardid)
WHERE s.logicalrelid = 'user_table'::regclass
ORDER BY placementid;
-- fail activate node by failing reference table creation
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE").cancel(' || pg_backend_pid() || ')');
SELECT master_activate_node('localhost', :worker_2_proxy_port);
-- verify node is not activated
SELECT * FROM master_get_active_worker_nodes()
ORDER BY 1, 2;
SELECT shardid, shardstate
FROM pg_dist_placement p JOIN pg_dist_shard s USING (shardid)
WHERE s.logicalrelid = 'user_table'::regclass
ORDER BY placementid;
SELECT citus.mitmproxy('conn.allow()');
-- master_remove_node fails when there are shards on that worker
SELECT master_remove_node('localhost', :worker_2_proxy_port);
@ -113,34 +90,6 @@ FROM pg_dist_placement p JOIN pg_dist_shard s USING (shardid)
WHERE s.logicalrelid = 'user_table'::regclass
ORDER BY placementid;
-- test master_add_node replicated a reference table
-- to newly added node.
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE").kill()');
SELECT master_add_node('localhost', :worker_2_proxy_port);
-- verify node is not added
SELECT * FROM master_get_active_worker_nodes()
ORDER BY 1, 2;
SELECT shardid, shardstate
FROM pg_dist_placement p JOIN pg_dist_shard s USING (shardid)
WHERE s.logicalrelid = 'user_table'::regclass
ORDER BY placementid;
SELECT citus.mitmproxy('conn.onQuery(query="CREATE TABLE").cancel(' || pg_backend_pid() || ')');
SELECT master_add_node('localhost', :worker_2_proxy_port);
-- verify node is not added
SELECT * FROM master_get_active_worker_nodes()
ORDER BY 1, 2;
SELECT shardid, shardstate
FROM pg_dist_placement p JOIN pg_dist_shard s USING (shardid)
WHERE s.logicalrelid = 'user_table'::regclass
ORDER BY placementid;
-- reset cluster to original state
SELECT citus.mitmproxy('conn.allow()');
SELECT master_add_node('localhost', :worker_2_proxy_port);
@ -154,15 +103,6 @@ FROM pg_dist_placement p JOIN pg_dist_shard s USING (shardid)
WHERE s.logicalrelid = 'user_table'::regclass
ORDER BY placementid;
-- fail master_add_node by failing copy out operation
SELECT master_remove_node('localhost', :worker_1_port);
SELECT citus.mitmproxy('conn.onQuery(query="COPY").kill()');
SELECT master_add_node('localhost', :worker_1_port);
-- verify node is not added
SELECT * FROM master_get_active_worker_nodes()
ORDER BY 1, 2;
SELECT citus.mitmproxy('conn.allow()');
SELECT master_add_node('localhost', :worker_1_port);

View File

@ -268,12 +268,11 @@ WHERE
logicalrelid IN ('replicate_reference_table_reference_one', 'replicate_reference_table_hash', 'replicate_reference_table_reference_two')
ORDER BY logicalrelid;
BEGIN;
SET LOCAL client_min_messages TO ERROR;
SET client_min_messages TO WARNING;
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
SELECT upgrade_to_reference_table('replicate_reference_table_hash');
SELECT create_reference_table('replicate_reference_table_reference_two');
COMMIT;
RESET client_min_messages;
-- status after master_add_node
SELECT