Fix crash with no distributed tables for rebalance plan

pull/5204/head
Sait Talha Nisanci 2021-08-25 10:02:35 +03:00
parent a31429aae5
commit 857040e1bb
3 changed files with 14 additions and 0 deletions

View File

@ -1753,6 +1753,11 @@ RebalancePlacementUpdates(List *workerNodeList, List *shardPlacementListList,
List *shardPlacementList = NIL;
List *placementUpdateList = NIL;
if (list_length(shardPlacementListList) == 0)
{
return NIL;
}
foreach_ptr(shardPlacementList, shardPlacementListList)
{
state = InitRebalanceState(workerNodeList, shardPlacementList,

View File

@ -35,6 +35,12 @@ SELECT * FROM master_add_node('localhost', :worker_1_port);
1
(1 row)
-- make sure that when there are no distributed tables, we don't crash.
SELECT 1 FROM get_rebalance_table_shards_plan();
?column?
---------------------------------------------------------------------
(0 rows)
-- get the active nodes
SELECT master_get_active_worker_nodes();
master_get_active_worker_nodes

View File

@ -15,6 +15,9 @@ 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);
-- make sure that when there are no distributed tables, we don't crash.
SELECT 1 FROM get_rebalance_table_shards_plan();
-- get the active nodes
SELECT master_get_active_worker_nodes();