mirror of https://github.com/citusdata/citus.git
Make multi_cluster_management test more stable
parent
e7846ba7d1
commit
74ce4faab5
|
@ -28,10 +28,10 @@ SELECT master_get_active_worker_nodes();
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
-- try to add a node that is already in the cluster
|
-- 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);
|
||||||
nodeid | groupid | nodename | nodeport | noderack | hasmetadata | isactive | noderole
|
nodeid | groupid
|
||||||
--------+---------+-----------+----------+----------+-------------+----------+----------
|
--------+---------
|
||||||
1 | 1 | localhost | 57637 | default | f | t | primary
|
1 | 1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- get the active nodes
|
-- get the active nodes
|
||||||
|
@ -140,10 +140,10 @@ SELECT master_get_active_worker_nodes();
|
||||||
SELECT master_disable_node('localhost.noexist', 2345);
|
SELECT master_disable_node('localhost.noexist', 2345);
|
||||||
ERROR: node at "localhost.noexist:2345" does not exist
|
ERROR: node at "localhost.noexist:2345" does not exist
|
||||||
-- restore the node for next tests
|
-- restore the node for next tests
|
||||||
SELECT master_activate_node('localhost', :worker_2_port);
|
SELECT isactive FROM master_activate_node('localhost', :worker_2_port);
|
||||||
master_activate_node
|
isactive
|
||||||
-------------------------------------------
|
----------
|
||||||
(3,3,localhost,57638,default,f,t,primary)
|
t
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- try to remove a node with active placements and see that node removal is failed
|
-- 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
|
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;
|
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
|
-- 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');
|
||||||
master_add_node
|
?column?
|
||||||
--------------------------------------------
|
----------
|
||||||
(5,4,localhost,9990,default,f,t,secondary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT master_remove_node('localhost', :worker_2_port);
|
SELECT master_remove_node('localhost', :worker_2_port);
|
||||||
|
@ -271,10 +271,11 @@ SELECT
|
||||||
|
|
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT * FROM pg_dist_node ORDER BY nodeid;
|
SELECT count(1) FROM pg_dist_node;
|
||||||
nodeid | groupid | nodename | nodeport | noderack | hasmetadata | isactive | noderole
|
count
|
||||||
--------+---------+----------+----------+----------+-------------+----------+----------
|
-------
|
||||||
(0 rows)
|
0
|
||||||
|
(1 row)
|
||||||
|
|
||||||
-- check that adding two nodes in the same transaction works
|
-- check that adding two nodes in the same transaction works
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -442,23 +443,23 @@ SELECT master_add_node('localhost', 9999, groupid => :worker_1_group, noderole =
|
||||||
ERROR: group 12 already has a primary node
|
ERROR: group 12 already has a primary node
|
||||||
-- check that you can add secondaries and unavailable nodes to a group
|
-- 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 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 1 FROM master_add_node('localhost', 9998, groupid => :worker_1_group, noderole => 'secondary');
|
||||||
master_add_node
|
?column?
|
||||||
----------------------------------------------
|
----------
|
||||||
(16,12,localhost,9998,default,f,t,secondary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT master_add_node('localhost', 9997, groupid => :worker_1_group, noderole => 'unavailable');
|
SELECT 1 FROM master_add_node('localhost', 9997, groupid => :worker_1_group, noderole => 'unavailable');
|
||||||
master_add_node
|
?column?
|
||||||
------------------------------------------------
|
----------
|
||||||
(17,12,localhost,9997,default,f,t,unavailable)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- add_inactive_node also works with secondaries
|
-- 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');
|
||||||
master_add_inactive_node
|
?column?
|
||||||
----------------------------------------------
|
----------
|
||||||
(18,14,localhost,9996,default,f,f,secondary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- check that you can't manually add two primaries to a group
|
-- check that you can't manually add two primaries to a group
|
||||||
|
|
|
@ -19,16 +19,16 @@ DROP EXTENSION citus CASCADE;
|
||||||
RESET client_min_messages;
|
RESET client_min_messages;
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
-- re-add the nodes to the cluster
|
-- re-add the nodes to the cluster
|
||||||
SELECT master_add_node('localhost', :worker_1_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_1_port);
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------
|
----------
|
||||||
(1,1,localhost,57637,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT master_add_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------
|
----------
|
||||||
(2,2,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- verify that a table can be created after the extension has been dropped and recreated
|
-- verify that a table can be created after the extension has been dropped and recreated
|
||||||
|
|
|
@ -90,10 +90,10 @@ SELECT count(*) FROM pg_dist_placement WHERE groupid = :worker_2_group;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- make sure when we activate a secondary we don't add any placements
|
-- 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);
|
||||||
master_activate_node
|
?column?
|
||||||
--------------------------------------------------------
|
----------
|
||||||
(1380002,1380000,localhost,9001,default,f,t,secondary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT count(*) FROM pg_dist_placement WHERE groupid = :worker_2_group;
|
SELECT count(*) FROM pg_dist_placement WHERE groupid = :worker_2_group;
|
||||||
|
@ -222,11 +222,11 @@ WHERE
|
||||||
SELECT master_remove_node('localhost', :worker_2_port);
|
SELECT master_remove_node('localhost', :worker_2_port);
|
||||||
ERROR: node at "localhost:57638" does not exist
|
ERROR: node at "localhost:57638" does not exist
|
||||||
-- re-add the node for next tests
|
-- 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 "remove_node_reference_table" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1380003,1380001,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- try to disable the node before removing it (this used to crash)
|
-- 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)
|
(1 row)
|
||||||
|
|
||||||
-- re-add the node for the next test
|
-- 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
|
NOTICE: Replicating reference table "remove_node_reference_table" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1380004,1380002,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- remove node in a transaction and ROLLBACK
|
-- remove node in a transaction and ROLLBACK
|
||||||
|
@ -466,11 +466,11 @@ WHERE
|
||||||
|
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
-- re-add the node for next tests
|
-- 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 "remove_node_reference_table" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1380005,1380003,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- test inserting a value then removing a node in a transaction
|
-- test inserting a value then removing a node in a transaction
|
||||||
|
@ -595,11 +595,11 @@ SELECT * FROM remove_node_reference_table;
|
||||||
|
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
-- re-add the node for next tests
|
-- 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 "remove_node_reference_table" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1380006,1380004,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- test executing DDL command then removing a node in a transaction
|
-- 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)
|
(2 rows)
|
||||||
|
|
||||||
-- re-add the node for next tests
|
-- 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 "remove_node_reference_table" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1380007,1380005,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- test DROP table after removing a node in a transaction
|
-- test DROP table after removing a node in a transaction
|
||||||
|
@ -789,10 +789,10 @@ SELECT * FROM pg_dist_colocation WHERE colocationid = 1380000;
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
-- re-add the node for next tests
|
-- 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);
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1380008,1380006,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- re-create remove_node_reference_table
|
-- re-create remove_node_reference_table
|
||||||
|
@ -922,12 +922,12 @@ WHERE
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
|
|
||||||
-- re-add the node for next tests
|
-- 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 "remove_node_reference_table" to the node localhost:57638
|
||||||
NOTICE: Replicating reference table "table1" to the node localhost:57638
|
NOTICE: Replicating reference table "table1" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1380009,1380007,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- test with master_disable_node
|
-- test with master_disable_node
|
||||||
|
@ -1040,12 +1040,12 @@ WHERE
|
||||||
|
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
-- re-add the node for next tests
|
-- 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 "remove_node_reference_table" to the node localhost:57638
|
||||||
NOTICE: Replicating reference table "table1" to the node localhost:57638
|
NOTICE: Replicating reference table "table1" to the node localhost:57638
|
||||||
master_activate_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1380009,1380007,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- DROP tables to clean workspace
|
-- DROP tables to clean workspace
|
||||||
|
|
|
@ -23,10 +23,10 @@ SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
|
||||||
0
|
0
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT master_add_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370000,1370000,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- verify node is added
|
-- verify node is added
|
||||||
|
@ -69,7 +69,7 @@ SELECT create_reference_table('replicate_reference_table_unhealthy');
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
UPDATE pg_dist_shard_placement SET shardstate = 3 WHERE shardid = 1370000;
|
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
|
ERROR: could not find any healthy placement for shard 1370000
|
||||||
-- verify node is not added
|
-- verify node is not added
|
||||||
SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
|
SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
|
||||||
|
@ -120,11 +120,11 @@ WHERE colocationid IN
|
||||||
1370001 | 1 | 1 | 0
|
1370001 | 1 | 1 | 0
|
||||||
(1 row)
|
(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
|
NOTICE: Replicating reference table "replicate_reference_table_valid" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370002,1370002,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- status after master_add_node
|
-- status after master_add_node
|
||||||
|
@ -174,10 +174,10 @@ WHERE colocationid IN
|
||||||
1370001 | 1 | 2 | 0
|
1370001 | 1 | 2 | 0
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT master_add_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370002,1370002,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- status after master_add_node
|
-- status after master_add_node
|
||||||
|
@ -241,11 +241,11 @@ WHERE colocationid IN
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
BEGIN;
|
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
|
NOTICE: Replicating reference table "replicate_reference_table_rollback" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370003,1370003,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
@ -303,11 +303,11 @@ WHERE colocationid IN
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
BEGIN;
|
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
|
NOTICE: Replicating reference table "replicate_reference_table_commit" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370004,1370004,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -398,11 +398,11 @@ ORDER BY logicalrelid;
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
BEGIN;
|
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
|
NOTICE: Replicating reference table "replicate_reference_table_reference_one" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370005,1370005,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT upgrade_to_reference_table('replicate_reference_table_hash');
|
SELECT upgrade_to_reference_table('replicate_reference_table_hash');
|
||||||
|
@ -480,7 +480,7 @@ SELECT create_reference_table('replicate_reference_table_insert');
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO replicate_reference_table_insert VALUES(1);
|
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
|
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
|
ERROR: cannot open new connections after the first modification command within a transaction
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
@ -495,7 +495,7 @@ SELECT create_reference_table('replicate_reference_table_copy');
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
COPY replicate_reference_table_copy FROM STDIN;
|
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
|
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
|
ERROR: cannot open new connections after the first modification command within a transaction
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
@ -512,7 +512,7 @@ BEGIN;
|
||||||
ALTER TABLE replicate_reference_table_ddl ADD column2 int;
|
ALTER TABLE replicate_reference_table_ddl ADD column2 int;
|
||||||
NOTICE: using one-phase commit for distributed DDL commands
|
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'
|
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
|
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
|
ERROR: cannot open new connections after the first modification command within a transaction
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
@ -548,11 +548,11 @@ WHERE colocationid IN
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
BEGIN;
|
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
|
NOTICE: Replicating reference table "replicate_reference_table_drop" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370009,1370009,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
DROP TABLE replicate_reference_table_drop;
|
DROP TABLE replicate_reference_table_drop;
|
||||||
|
@ -610,11 +610,11 @@ WHERE colocationid IN
|
||||||
1370010 | 1 | 1 | 0
|
1370010 | 1 | 1 | 0
|
||||||
(1 row)
|
(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
|
NOTICE: Replicating reference table "table1" to the node localhost:57638
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370010,1370010,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- status after master_add_node
|
-- status after master_add_node
|
||||||
|
@ -656,10 +656,10 @@ SELECT create_reference_table('initially_not_replicated_reference_table');
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT master_add_inactive_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_inactive_node('localhost', :worker_2_port);
|
||||||
master_add_inactive_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370011,1370011,localhost,57638,default,f,f,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- we should see only one shard placements
|
-- we should see only one shard placements
|
||||||
|
@ -681,11 +681,11 @@ ORDER BY 1,4,5;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- we should see the two shard placements after activation
|
-- 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
|
NOTICE: Replicating reference table "initially_not_replicated_reference_table" to the node localhost:57638
|
||||||
master_activate_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370011,1370011,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -707,10 +707,10 @@ ORDER BY 1,4,5;
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
-- this should have no effect
|
-- this should have no effect
|
||||||
SELECT master_add_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------------------
|
----------
|
||||||
(1370011,1370011,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- drop unnecassary tables
|
-- drop unnecassary tables
|
||||||
|
|
|
@ -76,16 +76,16 @@ SELECT * FROM pg_dist_shard_placement;
|
||||||
DROP EXTENSION citus;
|
DROP EXTENSION citus;
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
-- re-add the nodes to the cluster
|
-- re-add the nodes to the cluster
|
||||||
SELECT master_add_node('localhost', :worker_1_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_1_port);
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------
|
----------
|
||||||
(1,1,localhost,57637,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT master_add_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
master_add_node
|
?column?
|
||||||
-------------------------------------------
|
----------
|
||||||
(2,2,localhost,57638,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- create a table with a SERIAL column
|
-- create a table with a SERIAL column
|
||||||
|
|
|
@ -216,7 +216,7 @@ SELECT count(*) FROM mx_table;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- master_add_node
|
-- 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
|
ERROR: operation is not allowed on this node
|
||||||
HINT: Connect to the coordinator and run it again.
|
HINT: Connect to the coordinator and run it again.
|
||||||
SELECT count(1) FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
|
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;
|
DROP INDEX mx_test_uniq_index;
|
||||||
NOTICE: using one-phase commit for distributed DDL commands
|
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'
|
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);
|
SELECT 1 FROM master_add_node('localhost', 5432);
|
||||||
master_add_node
|
?column?
|
||||||
------------------------------------------------------
|
----------
|
||||||
(1370000,1370000,localhost,5432,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
SELECT master_remove_node('localhost', 5432);
|
SELECT master_remove_node('localhost', 5432);
|
||||||
ERROR: operation is not allowed on this node
|
ERROR: operation is not allowed on this node
|
||||||
HINT: Connect to the coordinator and run it again.
|
HINT: Connect to the coordinator and run it again.
|
||||||
SELECT * FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
|
SELECT count(1) FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
|
||||||
nodeid | groupid | nodename | nodeport | noderack | hasmetadata | isactive | noderole
|
count
|
||||||
---------+---------+-----------+----------+----------+-------------+----------+----------
|
-------
|
||||||
1370000 | 1370000 | localhost | 5432 | default | f | t | primary
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
|
|
|
@ -585,7 +585,7 @@ SELECT shardid, nodename, nodeport
|
||||||
WHERE logicalrelid = 'numbers_append'::regclass order by placementid;
|
WHERE logicalrelid = 'numbers_append'::regclass order by placementid;
|
||||||
|
|
||||||
-- add the node back
|
-- 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;
|
RESET citus.shard_replication_factor;
|
||||||
-- add two new shards and verify they are created at both workers
|
-- add two new shards and verify they are created at both workers
|
||||||
COPY numbers_append FROM STDIN WITH (FORMAT 'csv');
|
COPY numbers_append FROM STDIN WITH (FORMAT 'csv');
|
||||||
|
|
|
@ -764,12 +764,12 @@ SELECT shardid, nodename, nodeport
|
||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
-- add the node back
|
-- 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 "nation" to the node localhost:57637
|
||||||
NOTICE: Replicating reference table "supplier" to the node localhost:57637
|
NOTICE: Replicating reference table "supplier" to the node localhost:57637
|
||||||
master_activate_node
|
?column?
|
||||||
-------------------------------------------
|
----------
|
||||||
(1,1,localhost,57637,default,f,t,primary)
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
RESET citus.shard_replication_factor;
|
RESET citus.shard_replication_factor;
|
||||||
|
|
|
@ -15,7 +15,7 @@ SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
SELECT master_get_active_worker_nodes();
|
SELECT master_get_active_worker_nodes();
|
||||||
|
|
||||||
-- try to add a node that is already in the cluster
|
-- 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
|
-- get the active nodes
|
||||||
SELECT master_get_active_worker_nodes();
|
SELECT master_get_active_worker_nodes();
|
||||||
|
@ -56,7 +56,7 @@ SELECT master_get_active_worker_nodes();
|
||||||
SELECT master_disable_node('localhost.noexist', 2345);
|
SELECT master_disable_node('localhost.noexist', 2345);
|
||||||
|
|
||||||
-- restore the node for next tests
|
-- 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
|
-- try to remove a node with active placements and see that node removal is failed
|
||||||
SELECT master_remove_node('localhost', :worker_2_port);
|
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;
|
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
|
-- 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', :worker_2_port);
|
||||||
SELECT master_remove_node('localhost', 9990);
|
SELECT master_remove_node('localhost', 9990);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ SELECT nodename, nodeport FROM pg_dist_node WHERE nodename='localhost' AND nodep
|
||||||
SELECT
|
SELECT
|
||||||
master_remove_node('localhost', :worker_1_port),
|
master_remove_node('localhost', :worker_1_port),
|
||||||
master_remove_node('localhost', :worker_2_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
|
-- check that adding two nodes in the same transaction works
|
||||||
SELECT
|
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
|
-- 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 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 1 FROM 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', 9997, groupid => :worker_1_group, noderole => 'unavailable');
|
||||||
-- add_inactive_node also works with secondaries
|
-- 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
|
-- check that you can't manually add two primaries to a group
|
||||||
INSERT INTO pg_dist_node (nodename, nodeport, groupid, noderole)
|
INSERT INTO pg_dist_node (nodename, nodeport, groupid, noderole)
|
||||||
|
|
|
@ -21,8 +21,8 @@ RESET client_min_messages;
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
|
|
||||||
-- re-add the nodes to the cluster
|
-- re-add the nodes to the cluster
|
||||||
SELECT master_add_node('localhost', :worker_1_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_1_port);
|
||||||
SELECT master_add_node('localhost', :worker_2_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
|
-- verify that a table can be created after the extension has been dropped and recreated
|
||||||
CREATE TABLE testtableddl(somecol int, distributecol text NOT NULL);
|
CREATE TABLE testtableddl(somecol int, distributecol text NOT NULL);
|
||||||
|
|
|
@ -47,7 +47,7 @@ SELECT master_disable_node('localhost', 9001);
|
||||||
SELECT isactive FROM pg_dist_node WHERE nodeport = 9001;
|
SELECT isactive FROM pg_dist_node WHERE nodeport = 9001;
|
||||||
SELECT count(*) FROM pg_dist_placement WHERE groupid = :worker_2_group;
|
SELECT count(*) FROM pg_dist_placement WHERE groupid = :worker_2_group;
|
||||||
-- make sure when we activate a secondary we don't add any placements
|
-- 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;
|
SELECT count(*) FROM pg_dist_placement WHERE groupid = :worker_2_group;
|
||||||
-- make sure when we remove a secondary we don't remove any placements
|
-- make sure when we remove a secondary we don't remove any placements
|
||||||
SELECT master_remove_node('localhost', 9001);
|
SELECT master_remove_node('localhost', 9001);
|
||||||
|
@ -119,14 +119,14 @@ WHERE
|
||||||
SELECT master_remove_node('localhost', :worker_2_port);
|
SELECT master_remove_node('localhost', :worker_2_port);
|
||||||
|
|
||||||
-- re-add the node for next tests
|
-- 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)
|
-- try to disable the node before removing it (this used to crash)
|
||||||
SELECT master_disable_node('localhost', :worker_2_port);
|
SELECT master_disable_node('localhost', :worker_2_port);
|
||||||
SELECT master_remove_node('localhost', :worker_2_port);
|
SELECT master_remove_node('localhost', :worker_2_port);
|
||||||
|
|
||||||
-- re-add the node for the next test
|
-- 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
|
-- remove node in a transaction and ROLLBACK
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ WHERE
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
|
|
||||||
-- re-add the node for next tests
|
-- 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
|
-- test inserting a value then removing a node in a transaction
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ SELECT * FROM remove_node_reference_table;
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
|
|
||||||
-- re-add the node for next tests
|
-- 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
|
-- 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;
|
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.remove_node_reference_table'::regclass;
|
||||||
|
|
||||||
-- re-add the node for next tests
|
-- 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
|
-- test DROP table after removing a node in a transaction
|
||||||
|
@ -450,7 +450,7 @@ WHERE
|
||||||
SELECT * FROM pg_dist_colocation WHERE colocationid = 1380000;
|
SELECT * FROM pg_dist_colocation WHERE colocationid = 1380000;
|
||||||
|
|
||||||
-- re-add the node for next tests
|
-- 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
|
-- re-create remove_node_reference_table
|
||||||
CREATE TABLE remove_node_reference_table(column1 int);
|
CREATE TABLE remove_node_reference_table(column1 int);
|
||||||
|
@ -527,7 +527,7 @@ WHERE
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
|
|
||||||
-- re-add the node for next tests
|
-- 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
|
-- test with master_disable_node
|
||||||
|
@ -598,7 +598,7 @@ WHERE
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
|
|
||||||
-- re-add the node for next tests
|
-- 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
|
-- DROP tables to clean workspace
|
||||||
|
|
|
@ -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
|
-- 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 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
|
-- verify node is added
|
||||||
SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
|
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');
|
SELECT create_reference_table('replicate_reference_table_unhealthy');
|
||||||
UPDATE pg_dist_shard_placement SET shardstate = 3 WHERE shardid = 1370000;
|
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
|
-- verify node is not added
|
||||||
SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
|
SELECT COUNT(*) FROM pg_dist_node WHERE nodeport = :worker_2_port;
|
||||||
|
@ -80,7 +80,7 @@ WHERE colocationid IN
|
||||||
FROM pg_dist_partition
|
FROM pg_dist_partition
|
||||||
WHERE logicalrelid = 'replicate_reference_table_valid'::regclass);
|
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
|
-- status after master_add_node
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -115,7 +115,7 @@ WHERE colocationid IN
|
||||||
FROM pg_dist_partition
|
FROM pg_dist_partition
|
||||||
WHERE logicalrelid = 'replicate_reference_table_valid'::regclass);
|
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
|
-- status after master_add_node
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -157,7 +157,7 @@ WHERE colocationid IN
|
||||||
WHERE logicalrelid = 'replicate_reference_table_rollback'::regclass);
|
WHERE logicalrelid = 'replicate_reference_table_rollback'::regclass);
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
SELECT master_add_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
||||||
-- status after master_add_node
|
-- status after master_add_node
|
||||||
|
@ -198,7 +198,7 @@ WHERE colocationid IN
|
||||||
WHERE logicalrelid = 'replicate_reference_table_commit'::regclass);
|
WHERE logicalrelid = 'replicate_reference_table_commit'::regclass);
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
SELECT master_add_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- status after master_add_node
|
-- status after master_add_node
|
||||||
|
@ -260,7 +260,7 @@ WHERE
|
||||||
ORDER BY logicalrelid;
|
ORDER BY logicalrelid;
|
||||||
|
|
||||||
BEGIN;
|
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 upgrade_to_reference_table('replicate_reference_table_hash');
|
||||||
SELECT create_reference_table('replicate_reference_table_reference_two');
|
SELECT create_reference_table('replicate_reference_table_reference_two');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -304,7 +304,7 @@ SELECT create_reference_table('replicate_reference_table_insert');
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO replicate_reference_table_insert VALUES(1);
|
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;
|
ROLLBACK;
|
||||||
|
|
||||||
DROP TABLE replicate_reference_table_insert;
|
DROP TABLE replicate_reference_table_insert;
|
||||||
|
@ -322,7 +322,7 @@ COPY replicate_reference_table_copy FROM STDIN;
|
||||||
4
|
4
|
||||||
5
|
5
|
||||||
\.
|
\.
|
||||||
SELECT master_add_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
||||||
DROP TABLE replicate_reference_table_copy;
|
DROP TABLE replicate_reference_table_copy;
|
||||||
|
@ -334,7 +334,7 @@ SELECT create_reference_table('replicate_reference_table_ddl');
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
ALTER TABLE replicate_reference_table_ddl ADD column2 int;
|
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;
|
ROLLBACK;
|
||||||
|
|
||||||
DROP TABLE replicate_reference_table_ddl;
|
DROP TABLE replicate_reference_table_ddl;
|
||||||
|
@ -360,7 +360,7 @@ WHERE colocationid IN
|
||||||
WHERE logicalrelid = 'replicate_reference_table_drop'::regclass);
|
WHERE logicalrelid = 'replicate_reference_table_drop'::regclass);
|
||||||
|
|
||||||
BEGIN;
|
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;
|
DROP TABLE replicate_reference_table_drop;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ WHERE colocationid IN
|
||||||
FROM pg_dist_partition
|
FROM pg_dist_partition
|
||||||
WHERE logicalrelid = 'replicate_reference_table_schema.table1'::regclass);
|
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
|
-- status after master_add_node
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -422,7 +422,7 @@ SELECT master_remove_node('localhost', :worker_2_port);
|
||||||
CREATE TABLE initially_not_replicated_reference_table (key int);
|
CREATE TABLE initially_not_replicated_reference_table (key int);
|
||||||
SELECT create_reference_table('initially_not_replicated_reference_table');
|
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
|
-- we should see only one shard placements
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -439,7 +439,7 @@ WHERE
|
||||||
ORDER BY 1,4,5;
|
ORDER BY 1,4,5;
|
||||||
|
|
||||||
-- we should see the two shard placements after activation
|
-- 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
|
SELECT
|
||||||
shardid, shardstate, shardlength, nodename, nodeport
|
shardid, shardstate, shardlength, nodename, nodeport
|
||||||
|
@ -455,7 +455,7 @@ WHERE
|
||||||
ORDER BY 1,4,5;
|
ORDER BY 1,4,5;
|
||||||
|
|
||||||
-- this should have no effect
|
-- 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 unnecassary tables
|
||||||
DROP TABLE initially_not_replicated_reference_table;
|
DROP TABLE initially_not_replicated_reference_table;
|
||||||
|
|
|
@ -56,8 +56,8 @@ DROP EXTENSION citus;
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
|
|
||||||
-- re-add the nodes to the cluster
|
-- re-add the nodes to the cluster
|
||||||
SELECT master_add_node('localhost', :worker_1_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_1_port);
|
||||||
SELECT master_add_node('localhost', :worker_2_port);
|
SELECT 1 FROM master_add_node('localhost', :worker_2_port);
|
||||||
|
|
||||||
-- create a table with a SERIAL column
|
-- create a table with a SERIAL column
|
||||||
CREATE TABLE testserialtable(id serial, group_id integer);
|
CREATE TABLE testserialtable(id serial, group_id integer);
|
||||||
|
|
|
@ -118,17 +118,17 @@ SELECT count(*) FROM mx_table;
|
||||||
|
|
||||||
-- master_add_node
|
-- 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;
|
SELECT count(1) FROM pg_dist_node WHERE nodename='localhost' AND nodeport=5432;
|
||||||
|
|
||||||
-- master_remove_node
|
-- master_remove_node
|
||||||
\c - - - :master_port
|
\c - - - :master_port
|
||||||
DROP INDEX mx_test_uniq_index;
|
DROP INDEX mx_test_uniq_index;
|
||||||
SELECT master_add_node('localhost', 5432);
|
SELECT 1 FROM master_add_node('localhost', 5432);
|
||||||
|
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
SELECT master_remove_node('localhost', 5432);
|
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
|
\c - - - :master_port
|
||||||
SELECT master_remove_node('localhost', 5432);
|
SELECT master_remove_node('localhost', 5432);
|
||||||
|
|
Loading…
Reference in New Issue