Skip to content

Commit 86abe3f

Browse files
adding check for live instance tag
1 parent d59e954 commit 86abe3f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

helix-core/src/main/java/org/apache/helix/controller/rebalancer/CustomRebalancer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,13 @@ private Map<String, String> computeCustomizedBestStateForPartition(
135135
&& !HelixDefinedState.ERROR.toString().equals(currentStateMap.get(instance));
136136
boolean enabled = !disabledInstancesForPartition.contains(instance) && isResourceEnabled;
137137
InstanceConfig instanceConfig = cache.getInstanceConfigMap().get(instance);
138-
boolean isInstanceEvacuated = instanceConfig != null &&
138+
boolean hasEvacuatedOp = instanceConfig != null &&
139139
instanceConfig.getInstanceOperation().getOperation() == InstanceConstants.InstanceOperation.EVACUATE;
140+
boolean isAssignableForCustomizedResource = cache.getLiveInstances().containsKey(instance) && hasEvacuatedOp;
140141
// Note: if instance is not live, the mapping for that instance will not show up in
141142
// BestPossibleMapping (and ExternalView)
142143
// if instance is evacuated keep the instanceStateMap same as idealStateMap
143-
if ((assignableLiveInstancesMap.containsKey(instance) || isInstanceEvacuated) && notInErrorState) {
144+
if ((assignableLiveInstancesMap.containsKey(instance) || isAssignableForCustomizedResource) && notInErrorState) {
144145
if (enabled) {
145146
instanceStateMap.put(instance, idealStateMap.get(instance));
146147
} else {

0 commit comments

Comments
 (0)