LOG.debug("Processing resource:" + resource.getResourceName());
}
String stateModelDefName = idealState.getStateModelDefRef();
StateModelDefinition stateModelDef = cache.getStateModelDef(stateModelDefName);
calculateAutoBalancedIdealState(cache, idealState, stateModelDef);
ResourceAssignment partitionMapping = new ResourceAssignment();
for (Partition partition : resource.getPartitions()) {
Map<String, String> currentStateMap =
currentStateOutput.getCurrentStateMap(resource.getResourceName(), partition);
Set<String> disabledInstancesForPartition =
cache.getDisabledInstancesForPartition(partition.toString());
List<String> preferenceList =
ConstraintBasedAssignment.getPreferenceList(cache, partition, idealState, stateModelDef);
Map<String, String> bestStateForPartition =
ConstraintBasedAssignment.computeAutoBestStateForPartition(cache, stateModelDef,
preferenceList, currentStateMap, disabledInstancesForPartition);
partitionMapping.addReplicaMap(partition, bestStateForPartition);
}
return partitionMapping;
}