private void updateIdealStatePartitions(IdealState idealState,
      List<Map.Entry<String, Set<String>>> partitionsUnderResource) {
    for (Map.Entry<String, Set<String>> entry : partitionsUnderResource) {
      String partitionName = entry.getKey();
      ArrayList<String> instances = new ArrayList<>(entry.getValue());
      Collections.shuffle(instances);
      idealState.setPreferenceList(partitionName, instances);
    }
    idealState.setNumPartitions(idealState.getPartitionSet().size());
    idealState.setReplicas(ResourceConfig.ResourceConfigConstants.ANY_LIVEINSTANCE.name());
  }
Update the partition layout in the given ideal state.
@param idealState The ideal state to change partition layout
@param partitionsUnderResource The partition layout.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixBootstrapUpgradeUtil.java