diff --git a/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java b/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java index 152c766e43..62e6f35d20 100644 --- a/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java +++ b/helix-core/src/main/java/org/apache/helix/controller/stages/BestPossibleStateCalcStage.java @@ -321,6 +321,18 @@ private BestPossibleStateOutput compute(ClusterEvent event, Map { + if (currentStateOutput.getCurrentStateMap(resourceName).isEmpty()) { + return; + } + IdealState fakeIS = new IdealState(resourceName); + currentStateOutput.getCurrentStateMap(resourceName).forEach((partition, stateMap) -> + fakeIS.setInstanceStateMap(partition.getPartitionName(), stateMap != null ? stateMap : new HashMap<>()) + ); + updateBestPossibleStateOutput(output, resourceMap.get(resourceName), fakeIS); + }); + return output; }