Source:
<code>private void applyRebalanceOverwrite(Map<String, IdealState> idealStateMap, ResourceControllerDataProvider clusterData, Map<String, Resource> resourceMap, Map<HelixConstants.ChangeType, Set<String>> clusterChanges, Map<String, ResourceAssignment> baseline) throws HelixRebalanceException { Set<String> enabledLiveInstances = clusterData.getEnabledLiveInstances(); Map<String, IdealState> activeIdealStates = convertResourceAssignment(clusterData, <START> calculateAssignment(clusterData, clusterChanges, resourceMap, enabledLiveInstances, <END> Collections.emptyMap(), baseline)); for (String resourceName : idealStateMap.keySet()) { IdealState is = idealStateMap.get(resourceName); if (!activeIdealStates.containsKey(resourceName)) { throw new HelixRebalanceException( "Failed to calculate the complete partition assignment with all active nodes. Cannot find the resource assignment for " + resourceName, HelixRebalanceException.Type.FAILED_TO_CALCULATE); } IdealState newActiveIdealState = activeIdealStates.get(resourceName); IdealState currentIdealState = clusterData.getIdealState(resourceName); int numReplica = currentIdealState.getReplicaCount(enabledLiveInstances.size()); int minActiveReplica = DelayedRebalanceUtil.getMinActiveReplica(currentIdealState, numReplica); Map<String, List<String>> finalPreferenceLists = DelayedRebalanceUtil .getFinalDelayedMapping(newActiveIdealState.getPreferenceLists(), is.getPreferenceLists(), enabledLiveInstances, Math.min(minActiveReplica, numReplica)); is.setPreferenceLists(finalPreferenceLists); } }</code><technical_language>break this function? This is readable</technical_language>

Target:
private void applyRebalanceOverwrite(Map<String, IdealState> idealStateMap, ResourceControllerDataProvider clusterData, Map<String, Resource> resourceMap, Map<HelixConstants.ChangeType, Set<String>> clusterChanges, Map<String, ResourceAssignment> baseline) throws HelixRebalanceException { Set<String> enabledLiveInstances = clusterData.getEnabledLiveInstances(); Map<String, IdealState> activeIdealStates = convertResourceAssignment(clusterData, calculateAssignment(clusterData, clusterChanges, resourceMap, enabledLiveInstances, Collections.emptyMap(), baseline)); for (String resourceName : idealStateMap.keySet()) { IdealState newIdealState = idealStateMap.get(resourceName); if (!activeIdealStates.containsKey(resourceName)) { throw new HelixRebalanceException( "Failed to calculate the complete partition assignment with all active nodes. Cannot find the resource assignment for " + resourceName, HelixRebalanceException.Type.FAILED_TO_CALCULATE); } IdealState newActiveIdealState = activeIdealStates.get(resourceName); IdealState currentIdealState = clusterData.getIdealState(resourceName); int numReplica = currentIdealState.getReplicaCount(enabledLiveInstances.size()); int minActiveReplica = DelayedRebalanceUtil.getMinActiveReplica(currentIdealState, numReplica); Map<String, List<String>> finalPreferenceLists = DelayedRebalanceUtil .getFinalDelayedMapping(newActiveIdealState.getPreferenceLists(), newIdealState.getPreferenceLists(), enabledLiveInstances, Math.min(minActiveReplica, numReplica)); newIdealState.setPreferenceLists(finalPreferenceLists); } }