TreeMap<Integer, Set<String>> getResourceNameToInstances(Map<Integer, IdealState> allIdealState) {
    TreeMap<Integer, Set<String>> resourceNameToInstances = new TreeMap<>();
    for (Map.Entry<Integer, IdealState> ent : allIdealState.entrySet()) {
      Integer resourceId = ent.getKey();
      resourceNameToInstances.put(resourceId, new HashSet<>());
      IdealState resourceIS = ent.getValue();
      Set<String> resourcePartitions = resourceIS.getPartitionSet();
      for (String resourcePartition : resourcePartitions) {
        Set<String> partitionInstanceSet = resourceIS.getInstanceSet(resourcePartition);
        resourceNameToInstances.get(resourceId).addAll(partitionInstanceSet);
      }
    }
    return resourceNameToInstances;
  }
Fetch the set of instances for each resource from IdealState and return a map from resource id to its corresponding
list.
@param allIdealState The map from resource id to ideal state.
@return
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixBootstrapUpgradeUtil.java