Make multi_cluster_management test more stable

pull/1530/head
Brian Cloutier 2017-07-27 14:01:18 +03:00 committed by Brian Cloutier
parent e7846ba7d1
commit 74ce4faab5
14 changed files with 181 additions and 180 deletions

View File

@ -28,10 +28,10 @@ SELECT master_get_active_worker_nodes();
(2 rows)
-- try to add a node that is already in the cluster
SELECT * FROM master_add_node('localhost', :worker_1_port);
nodeid | groupid | nodename | nodeport | noderack | hasmetadata | isactive | noderole
--------+---------+-----------+----------+----------+-------------+----------+----------
1 | 1 | localhost | 57637 | default | f | t | primary
SELECT nodeid, groupid FROM master_add_node('localhost', :worker_1_port);
nodeid | groupid
--------+---------
1 | 1
(1 row)
-- get the active nodes
@ -140,10 +140,10 @@ SELECT master_get_active_worker_nodes();
SELECT master_disable_node('localhost.noexist', 2345);
ERROR: node at "localhost.noexist:2345" does not exist
-- restore the node for next tests
SELECT master_activate_node('localhost', :worker_2_port);
master_activate_node
-------------------------------------------
(3,3,localhost,57638,default,f,t,primary)
SELECT isactive FROM master_activate_node('localhost', :worker_2_port);
isactive
----------
t
(1 row)
-- try to remove a node with active placements and see that node removal is failed
@ -196,10 +196,10 @@ DETAIL: there is a placement in group 3 but there are no nodes in that group
SELECT groupid as new_group FROM master_add_node('localhost', :worker_2_port) \gset
UPDATE pg_dist_placement SET groupid = :new_group WHERE groupid = :worker_2_group;
-- test that you are allowed to remove secondary nodes even if there are placements
SELECT master_add_node('localhost', 9990, groupid => :new_group, noderole => 'secondary');
master_add_node
--------------------------------------------
(5,4,localhost,9990,default,f,t,secondary)
SELECT 1 FROM master_add_node('localhost', 9990, groupid => :new_group, noderole => 'secondary');
?column?
----------
1
(1 row)
SELECT master_remove_node('localhost', :worker_2_port);
@ -271,10 +271,11 @@ SELECT
|
(1 row)
SELECT * FROM pg_dist_node ORDER BY nodeid;
nodeid | groupid | nodename | nodeport | noderack | hasmetadata | isactive | noderole
--------+---------+----------+----------+----------+-------------+----------+----------
(0 rows)
SELECT count(1) FROM pg_dist_node;
count
-------
0
(1 row)
-- check that adding two nodes in the same transaction works
SELECT
@ -442,23 +443,23 @@ SELECT master_add_node('localhost', 9999, groupid => :worker_1_group, noderole =
ERROR: group 12 already has a primary node
-- check that you can add secondaries and unavailable nodes to a group
SELECT groupid AS worker_2_group FROM pg_dist_node WHERE nodeport = :worker_2_port \gset
SELECT master_add_node('localhost', 9998, groupid => :worker_1_group, noderole => 'secondary');
master_add_node
----------------------------------------------
(16,12,localhost,9998,default,f,t,secondary)
SELECT 1 FROM master_add_node('localhost', 9998, groupid => :worker_1_group, noderole => 'secondary');
?column?
----------
1
(1 row)
SELECT master_add_node('localhost', 9997, groupid => :worker_1_group, noderole => 'unavailable');
master_add_node
------------------------------------------------
(17,12,localhost,9997,default,f,t,unavailable)
SELECT 1 FROM master_add_node('localhost', 9997, groupid => :worker_1_group, noderole => 'unavailable');
?column?
----------
1
(1 row)
-- add_inactive_node also works with secondaries
SELECT master_add_inactive_node('localhost', 9996, groupid => :worker_2_group, noderole => 'secondary');
master_add_inactive_node
----------------------------------------------
(18,14,localhost,9996,default,f,f,secondary)
SELECT 1 FROM master_add_inactive_node('localhost', 9996, groupid => :worker_2_group, noderole => 'secondary');
?column?
----------
1
(1 row)
-- check that you can't manually add two primaries to a group

View File

@ -19,16 +19,16 @@ DROP EXTENSION citus CASCADE;
RESET client_min_messages;
CREATE EXTENSION citus;
-- re-add the nodes to the cluster
SELECT master_add_node('localhost', :worker_1_port);
master_add_node
-------------------------------------------
(1,1,localhost,57637,default,f,t,primary)
SELECT 1 FROM master_add_node('localhost', :worker_1_port);
?column?
----------
1
(1 row)
SELECT master_add_node('localhost', :worker_2_port);
master_add_node
-------------------------------------------
(2,2,localhost,57638,default,f,t,primary)
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
?column?
----------
1
(1 row)
-- verify that a table can be created after the extension has been dropped and recreated

View File

@ -90,10 +90,10 @@ SELECT count(*) FROM pg_dist_placement WHERE groupid = :worker_2_group;
(1 row)
-- make sure when we activate a secondary we don't add any placements
SELECT master_activate_node('localhost', 9001);
master_activate_node
--------------------------------------------------------
(1380002,1380000,localhost,9001,default,f,t,secondary)
SELECT 1 FROM master_activate_node('localhost', 9001);
?column?
----------
1
(1 row)
SELECT count(*) FROM pg_dist_placement WHERE groupid = :worker_2_group;
@ -222,11 +222,11 @@ WHERE
SELECT master_remove_node('localhost', :worker_2_port);
ERROR: node at "localhost:57638" does not exist
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1380003,1380001,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
-- try to disable the node before removing it (this used to crash)
@ -243,11 +243,11 @@ SELECT master_remove_node('localhost', :worker_2_port);
(1 row)
-- re-add the node for the next test
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1380004,1380002,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
-- remove node in a transaction and ROLLBACK
@ -466,11 +466,11 @@ WHERE
\c - - - :master_port
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1380005,1380003,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
-- test inserting a value then removing a node in a transaction
@ -595,11 +595,11 @@ SELECT * FROM remove_node_reference_table;
\c - - - :master_port
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1380006,1380004,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
-- test executing DDL command then removing a node in a transaction
@ -720,11 +720,11 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.remove_
(2 rows)
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1380007,1380005,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
-- test DROP table after removing a node in a transaction
@ -789,10 +789,10 @@ SELECT * FROM pg_dist_colocation WHERE colocationid = 1380000;
(0 rows)
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
master_add_node
-------------------------------------------------------
(1380008,1380006,localhost,57638,default,f,t,primary)
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
?column?
----------
1
(1 row)
-- re-create remove_node_reference_table
@ -922,12 +922,12 @@ WHERE
\c - - - :master_port
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:57638
NOTICE: Replicating reference table "table1" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1380009,1380007,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
-- test with master_disable_node
@ -1040,12 +1040,12 @@ WHERE
\c - - - :master_port
-- re-add the node for next tests
SELECT master_activate_node('localhost', :worker_2_port);
SELECT 1 FROM master_activate_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:57638
NOTICE: Replicating reference table "table1" to the node localhost:57638
master_activate_node
-------------------------------------------------------
(1380009,1380007,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
-- DROP tables to clean workspace

View File

@ -23,10 +23,10 @@ SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
0
(1 row)
SELECT master_add_node('localhost', :worker_2_port);
master_add_node
-------------------------------------------------------
(1370000,1370000,localhost,57638,default,f,t,primary)
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
?column?
----------
1
(1 row)
-- verify node is added
@ -69,7 +69,7 @@ SELECT create_reference_table('replicate_reference_table_unhealthy');
(1 row)
UPDATE pg_dist_shard_placement SET shardstate = 3 WHERE shardid = 1370000;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
ERROR: could not find any healthy placement for shard 1370000
-- verify node is not added
SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
@ -120,11 +120,11 @@ WHERE colocationid IN
1370001 | 1 | 1 | 0
(1 row)
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_valid" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1370002,1370002,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
-- status after master_add_node
@ -174,10 +174,10 @@ WHERE colocationid IN
1370001 | 1 | 2 | 0
(1 row)
SELECT master_add_node('localhost', :worker_2_port);
master_add_node
-------------------------------------------------------
(1370002,1370002,localhost,57638,default,f,t,primary)
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
?column?
----------
1
(1 row)
-- status after master_add_node
@ -241,11 +241,11 @@ WHERE colocationid IN
(1 row)
BEGIN;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_rollback" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1370003,1370003,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
ROLLBACK;
@ -303,11 +303,11 @@ WHERE colocationid IN
(1 row)
BEGIN;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_commit" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1370004,1370004,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
COMMIT;
@ -398,11 +398,11 @@ ORDER BY logicalrelid;
(2 rows)
BEGIN;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_reference_one" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1370005,1370005,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
SELECT upgrade_to_reference_table('replicate_reference_table_hash');
@ -480,7 +480,7 @@ SELECT create_reference_table('replicate_reference_table_insert');
BEGIN;
INSERT INTO replicate_reference_table_insert VALUES(1);
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_insert" to the node localhost:57638
ERROR: cannot open new connections after the first modification command within a transaction
ROLLBACK;
@ -495,7 +495,7 @@ SELECT create_reference_table('replicate_reference_table_copy');
BEGIN;
COPY replicate_reference_table_copy FROM STDIN;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_copy" to the node localhost:57638
ERROR: cannot open new connections after the first modification command within a transaction
ROLLBACK;
@ -512,7 +512,7 @@ BEGIN;
ALTER TABLE replicate_reference_table_ddl ADD column2 int;
NOTICE: using one-phase commit for distributed DDL commands
HINT: You can enable two-phase commit for extra safety with: SET citus.multi_shard_commit_protocol TO '2pc'
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_ddl" to the node localhost:57638
ERROR: cannot open new connections after the first modification command within a transaction
ROLLBACK;
@ -548,11 +548,11 @@ WHERE colocationid IN
(1 row)
BEGIN;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "replicate_reference_table_drop" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1370009,1370009,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
DROP TABLE replicate_reference_table_drop;
@ -610,11 +610,11 @@ WHERE colocationid IN
1370010 | 1 | 1 | 0
(1 row)
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "table1" to the node localhost:57638
master_add_node
-------------------------------------------------------
(1370010,1370010,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
-- status after master_add_node
@ -656,10 +656,10 @@ SELECT create_reference_table('initially_not_replicated_reference_table');
(1 row)
SELECT master_add_inactive_node('localhost', :worker_2_port);
master_add_inactive_node
-------------------------------------------------------
(1370011,1370011,localhost,57638,default,f,f,primary)
SELECT 1 FROM master_add_inactive_node('localhost', :worker_2_port);
?column?
----------
1
(1 row)
-- we should see only one shard placements
@ -681,11 +681,11 @@ ORDER BY 1,4,5;
(1 row)
-- we should see the two shard placements after activation
SELECT master_activate_node('localhost', :worker_2_port);
SELECT 1 FROM master_activate_node('localhost', :worker_2_port);
NOTICE: Replicating reference table "initially_not_replicated_reference_table" to the node localhost:57638
master_activate_node
-------------------------------------------------------
(1370011,1370011,localhost,57638,default,f,t,primary)
?column?
----------
1
(1 row)
SELECT
@ -707,10 +707,10 @@ ORDER BY 1,4,5;
(2 rows)
-- this should have no effect
SELECT master_add_node('localhost', :worker_2_port);
master_add_node
-------------------------------------------------------
(1370011,1370011,localhost,57638,default,f,t,primary)
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
?column?
----------
1
(1 row)
-- drop unnecassary tables

View File

@ -76,16 +76,16 @@ SELECT * FROM pg_dist_shard_placement;
DROP EXTENSION citus;
CREATE EXTENSION citus;
-- re-add the nodes to the cluster
SELECT master_add_node('localhost', :worker_1_port);
master_add_node
-------------------------------------------
(1,1,localhost,57637,default,f,t,primary)
SELECT 1 FROM master_add_node('localhost', :worker_1_port);
?column?
----------
1
(1 row)
SELECT master_add_node('localhost', :worker_2_port);
master_add_node
-------------------------------------------
(2,2,localhost,57638,default,f,t,primary)
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
?column?
----------
1
(1 row)
-- create a table with a SERIAL column

View File

@ -216,7 +216,7 @@ SELECT count(*) FROM mx_table;
(1 row)
-- master_add_node
SELECT master_add_node('localhost', 5432);
SELECT 1 FROM master_add_node('localhost', 5432);
ERROR: operation is not allowed on this node
HINT: Connect to the coordinator and run it again.
SELECT count(1) FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
@ -230,20 +230,20 @@ SELECT count(1) FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
DROP INDEX mx_test_uniq_index;
NOTICE: using one-phase commit for distributed DDL commands
HINT: You can enable two-phase commit for extra safety with: SET citus.multi_shard_commit_protocol TO '2pc'
SELECT master_add_node('localhost', 5432);
master_add_node
------------------------------------------------------
(1370000,1370000,localhost,5432,default,f,t,primary)
SELECT 1 FROM master_add_node('localhost', 5432);
?column?
----------
1
(1 row)
\c - - - :worker_1_port
SELECT master_remove_node('localhost', 5432);
ERROR: operation is not allowed on this node
HINT: Connect to the coordinator and run it again.
SELECT * FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
nodeid | groupid | nodename | nodeport | noderack | hasmetadata | isactive | noderole
---------+---------+-----------+----------+----------+-------------+----------+----------
1370000 | 1370000 | localhost | 5432 | default | f | t | primary
SELECT count(1) FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
count
-------
1
(1 row)
\c - - - :master_port

View File

@ -585,7 +585,7 @@ SELECT shardid, nodename, nodeport
WHERE logicalrelid = 'numbers_append'::regclass order by placementid;
-- add the node back
SELECT master_activate_node('localhost', :worker_1_port);
SELECT 1 FROM master_activate_node('localhost', :worker_1_port);
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

@ -764,12 +764,12 @@ SELECT shardid, nodename, nodeport
(6 rows)
-- add the node back
SELECT master_activate_node('localhost', :worker_1_port);
SELECT 1 FROM master_activate_node('localhost', :worker_1_port);
NOTICE: Replicating reference table "nation" to the node localhost:57637
NOTICE: Replicating reference table "supplier" to the node localhost:57637
master_activate_node
-------------------------------------------
(1,1,localhost,57637,default,f,t,primary)
?column?
----------
1
(1 row)
RESET citus.shard_replication_factor;

View File

@ -15,7 +15,7 @@ SELECT 1 FROM master_add_node('localhost', :worker_2_port);
SELECT master_get_active_worker_nodes();
-- try to add a node that is already in the cluster
SELECT * FROM master_add_node('localhost', :worker_1_port);
SELECT nodeid, groupid FROM master_add_node('localhost', :worker_1_port);
-- get the active nodes
SELECT master_get_active_worker_nodes();
@ -56,7 +56,7 @@ SELECT master_get_active_worker_nodes();
SELECT master_disable_node('localhost.noexist', 2345);
-- restore the node for next tests
SELECT master_activate_node('localhost', :worker_2_port);
SELECT isactive FROM master_activate_node('localhost', :worker_2_port);
-- try to remove a node with active placements and see that node removal is failed
SELECT master_remove_node('localhost', :worker_2_port);
@ -87,7 +87,7 @@ SELECT groupid as new_group FROM master_add_node('localhost', :worker_2_port) \g
UPDATE pg_dist_placement SET groupid = :new_group WHERE groupid = :worker_2_group;
-- test that you are allowed to remove secondary nodes even if there are placements
SELECT master_add_node('localhost', 9990, groupid => :new_group, noderole => 'secondary');
SELECT 1 FROM master_add_node('localhost', 9990, groupid => :new_group, noderole => 'secondary');
SELECT master_remove_node('localhost', :worker_2_port);
SELECT master_remove_node('localhost', 9990);
@ -117,7 +117,7 @@ SELECT nodename, nodeport FROM pg_dist_node WHERE nodename='localhost' AND nodep
SELECT
master_remove_node('localhost', :worker_1_port),
master_remove_node('localhost', :worker_2_port);
SELECT * FROM pg_dist_node ORDER BY nodeid;
SELECT count(1) FROM pg_dist_node;
-- check that adding two nodes in the same transaction works
SELECT
@ -190,10 +190,10 @@ SELECT master_add_node('localhost', 9999, groupid => :worker_1_group, noderole =
-- check that you can add secondaries and unavailable nodes to a group
SELECT groupid AS worker_2_group FROM pg_dist_node WHERE nodeport = :worker_2_port \gset
SELECT master_add_node('localhost', 9998, groupid => :worker_1_group, noderole => 'secondary');
SELECT master_add_node('localhost', 9997, groupid => :worker_1_group, noderole => 'unavailable');
SELECT 1 FROM master_add_node('localhost', 9998, groupid => :worker_1_group, noderole => 'secondary');
SELECT 1 FROM master_add_node('localhost', 9997, groupid => :worker_1_group, noderole => 'unavailable');
-- add_inactive_node also works with secondaries
SELECT master_add_inactive_node('localhost', 9996, groupid => :worker_2_group, noderole => 'secondary');
SELECT 1 FROM master_add_inactive_node('localhost', 9996, groupid => :worker_2_group, noderole => 'secondary');
-- check that you can't manually add two primaries to a group
INSERT INTO pg_dist_node (nodename, nodeport, groupid, noderole)

View File

@ -21,8 +21,8 @@ RESET client_min_messages;
CREATE EXTENSION citus;
-- re-add the nodes to the cluster
SELECT master_add_node('localhost', :worker_1_port);
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_1_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- verify that a table can be created after the extension has been dropped and recreated
CREATE TABLE testtableddl(somecol int, distributecol text NOT NULL);

View File

@ -47,7 +47,7 @@ SELECT master_disable_node('localhost', 9001);
SELECT isactive FROM pg_dist_node WHERE nodeport = 9001;
SELECT count(*) FROM pg_dist_placement WHERE groupid = :worker_2_group;
-- make sure when we activate a secondary we don't add any placements
SELECT master_activate_node('localhost', 9001);
SELECT 1 FROM master_activate_node('localhost', 9001);
SELECT count(*) FROM pg_dist_placement WHERE groupid = :worker_2_group;
-- make sure when we remove a secondary we don't remove any placements
SELECT master_remove_node('localhost', 9001);
@ -119,14 +119,14 @@ WHERE
SELECT master_remove_node('localhost', :worker_2_port);
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- try to disable the node before removing it (this used to crash)
SELECT master_disable_node('localhost', :worker_2_port);
SELECT master_remove_node('localhost', :worker_2_port);
-- re-add the node for the next test
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- remove node in a transaction and ROLLBACK
@ -261,7 +261,7 @@ WHERE
\c - - - :master_port
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- test inserting a value then removing a node in a transaction
@ -336,7 +336,7 @@ SELECT * FROM remove_node_reference_table;
\c - - - :master_port
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- test executing DDL command then removing a node in a transaction
@ -410,7 +410,7 @@ WHERE
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.remove_node_reference_table'::regclass;
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- test DROP table after removing a node in a transaction
@ -450,7 +450,7 @@ WHERE
SELECT * FROM pg_dist_colocation WHERE colocationid = 1380000;
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- re-create remove_node_reference_table
CREATE TABLE remove_node_reference_table(column1 int);
@ -527,7 +527,7 @@ WHERE
\c - - - :master_port
-- re-add the node for next tests
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- test with master_disable_node
@ -598,7 +598,7 @@ WHERE
\c - - - :master_port
-- re-add the node for next tests
SELECT master_activate_node('localhost', :worker_2_port);
SELECT 1 FROM master_activate_node('localhost', :worker_2_port);
-- DROP tables to clean workspace

View File

@ -21,7 +21,7 @@ SELECT master_remove_node('localhost', :worker_2_port);
-- verify there is no node with nodeport = :worker_2_port before adding the node
SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- verify node is added
SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
@ -45,7 +45,7 @@ CREATE TABLE replicate_reference_table_unhealthy(column1 int);
SELECT create_reference_table('replicate_reference_table_unhealthy');
UPDATE pg_dist_shard_placement SET shardstate = 3 WHERE shardid = 1370000;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- verify node is not added
SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
@ -80,7 +80,7 @@ WHERE colocationid IN
FROM pg_dist_partition
WHERE logicalrelid = 'replicate_reference_table_valid'::regclass);
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- status after master_add_node
SELECT
@ -115,7 +115,7 @@ WHERE colocationid IN
FROM pg_dist_partition
WHERE logicalrelid = 'replicate_reference_table_valid'::regclass);
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- status after master_add_node
SELECT
@ -157,7 +157,7 @@ WHERE colocationid IN
WHERE logicalrelid = 'replicate_reference_table_rollback'::regclass);
BEGIN;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
ROLLBACK;
-- status after master_add_node
@ -198,7 +198,7 @@ WHERE colocationid IN
WHERE logicalrelid = 'replicate_reference_table_commit'::regclass);
BEGIN;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
COMMIT;
-- status after master_add_node
@ -260,7 +260,7 @@ WHERE
ORDER BY logicalrelid;
BEGIN;
SELECT master_add_node('localhost', :worker_2_port);
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;
@ -304,7 +304,7 @@ SELECT create_reference_table('replicate_reference_table_insert');
BEGIN;
INSERT INTO replicate_reference_table_insert VALUES(1);
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
ROLLBACK;
DROP TABLE replicate_reference_table_insert;
@ -322,7 +322,7 @@ COPY replicate_reference_table_copy FROM STDIN;
4
5
\.
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
ROLLBACK;
DROP TABLE replicate_reference_table_copy;
@ -334,7 +334,7 @@ SELECT create_reference_table('replicate_reference_table_ddl');
BEGIN;
ALTER TABLE replicate_reference_table_ddl ADD column2 int;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
ROLLBACK;
DROP TABLE replicate_reference_table_ddl;
@ -360,7 +360,7 @@ WHERE colocationid IN
WHERE logicalrelid = 'replicate_reference_table_drop'::regclass);
BEGIN;
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
DROP TABLE replicate_reference_table_drop;
COMMIT;
@ -396,7 +396,7 @@ WHERE colocationid IN
FROM pg_dist_partition
WHERE logicalrelid = 'replicate_reference_table_schema.table1'::regclass);
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- status after master_add_node
SELECT
@ -422,7 +422,7 @@ SELECT master_remove_node('localhost', :worker_2_port);
CREATE TABLE initially_not_replicated_reference_table (key int);
SELECT create_reference_table('initially_not_replicated_reference_table');
SELECT master_add_inactive_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_inactive_node('localhost', :worker_2_port);
-- we should see only one shard placements
SELECT
@ -439,7 +439,7 @@ WHERE
ORDER BY 1,4,5;
-- we should see the two shard placements after activation
SELECT master_activate_node('localhost', :worker_2_port);
SELECT 1 FROM master_activate_node('localhost', :worker_2_port);
SELECT
shardid, shardstate, shardlength, nodename, nodeport
@ -455,7 +455,7 @@ WHERE
ORDER BY 1,4,5;
-- this should have no effect
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- drop unnecassary tables
DROP TABLE initially_not_replicated_reference_table;

View File

@ -56,8 +56,8 @@ DROP EXTENSION citus;
CREATE EXTENSION citus;
-- re-add the nodes to the cluster
SELECT master_add_node('localhost', :worker_1_port);
SELECT master_add_node('localhost', :worker_2_port);
SELECT 1 FROM master_add_node('localhost', :worker_1_port);
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
-- create a table with a SERIAL column
CREATE TABLE testserialtable(id serial, group_id integer);

View File

@ -118,17 +118,17 @@ SELECT count(*) FROM mx_table;
-- master_add_node
SELECT master_add_node('localhost', 5432);
SELECT 1 FROM master_add_node('localhost', 5432);
SELECT count(1) FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
-- master_remove_node
\c - - - :master_port
DROP INDEX mx_test_uniq_index;
SELECT master_add_node('localhost', 5432);
SELECT 1 FROM master_add_node('localhost', 5432);
\c - - - :worker_1_port
SELECT master_remove_node('localhost', 5432);
SELECT * FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
SELECT count(1) FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
\c - - - :master_port
SELECT master_remove_node('localhost', 5432);