mirror of https://github.com/citusdata/citus.git
Merge pull request #5021 from citusdata/marcocitus/fix-remove-node
commit
ec9664c5a4
|
@ -1292,7 +1292,7 @@ RemoveNodeFromCluster(char *nodeName, int32 nodePort)
|
|||
}
|
||||
if (NodeGroupHasLivePlacements(workerNode->groupId))
|
||||
{
|
||||
if (ClusterHasReferenceTable())
|
||||
if (ActivePrimaryNodeCount() == 1 && ClusterHasReferenceTable())
|
||||
{
|
||||
ereport(ERROR, (errmsg(
|
||||
"cannot remove the last worker node because there are reference "
|
||||
|
|
|
@ -136,6 +136,10 @@ SELECT create_reference_table('test_reference_table');
|
|||
(1 row)
|
||||
|
||||
INSERT INTO test_reference_table VALUES (1, '1');
|
||||
-- try to remove a node with active placements and reference tables
|
||||
SELECT citus_remove_node('localhost', :worker_2_port);
|
||||
ERROR: cannot remove the primary node of a node group which has shard placements
|
||||
HINT: To proceed, either drop the distributed tables or use undistribute_table() function to convert them to local tables
|
||||
-- try to disable a node with active placements see that node is removed
|
||||
-- observe that a notification is displayed
|
||||
SELECT master_disable_node('localhost', :worker_2_port);
|
||||
|
|
|
@ -54,6 +54,9 @@ CREATE TABLE test_reference_table (y int primary key, name text);
|
|||
SELECT create_reference_table('test_reference_table');
|
||||
INSERT INTO test_reference_table VALUES (1, '1');
|
||||
|
||||
-- try to remove a node with active placements and reference tables
|
||||
SELECT citus_remove_node('localhost', :worker_2_port);
|
||||
|
||||
-- try to disable a node with active placements see that node is removed
|
||||
-- observe that a notification is displayed
|
||||
SELECT master_disable_node('localhost', :worker_2_port);
|
||||
|
|
Loading…
Reference in New Issue