public Map<DiskId, DiskId> reshuffleDisks(Map<DiskId, List<ReplicaId>> expectedDiskToReplicaMap, Map<DiskId, Set<String>> actualDiskToPartitionMap) {
    Map<DiskId, DiskId> shuffledDisks = new HashMap<>();
    computeDiskDifferences(expectedDiskToReplicaMap, actualDiskToPartitionMap);

    // Sanity checks: - Abort if we did not find the same number of disks on the
    //                  host as we got from Helix.
    //                - Abort if we did not find any broken disks.
    if ((expectedDiskToReplicaMap.size() != foundDiskToPartitionMap.size()) ||
        brokenDisks.size() == 0) {
      return Collections.emptyMap();
    }

    for (DiskId currentDisk : brokenDisks) {
      List<ReplicaId> expectedReplicas = expectedDiskToReplicaMap.get(currentDisk);
      DiskId foundDisk = findDiskWithReplicas(expectedReplicas);
      if(foundDisk == null) {
        return Collections.emptyMap();
      } else {
        shuffledDisks.put(currentDisk, foundDisk);
      }
    }
    return shuffledDisks;
  }
Check the placement of replicas on the disks and reshuffle them if necessary.
@return A map of the broken disks and the disks they should be reshuffled to.
        An empty map if no reshuffling is necessary or if the reshuffling failed.
ambry-store/src/main/java/com/github/ambry/store/ReplicaPlacementValidator.java