Merge pull request #5021 from citusdata/marcocitus/fix-remove-node

pull/5020/head
Marco Slot 2021-06-03 11:27:57 +02:00 committed by GitHub
commit ec9664c5a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

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

View File

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

View File

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