static boolean areAllReplicasDistributed(BalancerClusterState cluster) {
    // Iterate over each server
    for (int[] regionsPerServer : cluster.regionsPerServer) {
      if (regionsPerServer == null || regionsPerServer.length == 0) {
        continue; // Skip empty servers
      }

      Set<ReplicaKey> foundKeys = new HashSet<>();
      for (int regionIndex : regionsPerServer) {
        RegionInfo regionInfo = cluster.regions[regionIndex];
        ReplicaKey replicaKey = new ReplicaKey(regionInfo);
        if (foundKeys.contains(replicaKey)) {
          // Violation: Multiple replicas of the same region on the same server
          LOG.warn("Replica isolation violated: one server hosts multiple replicas of key [{}].",
            generateRegionKey(regionInfo));
          return false;
        }

        foundKeys.add(replicaKey);
      }
    }

    LOG.info(
      "Replica isolation validation passed: No server hosts multiple replicas of the same region.");
    return true;
  }
Validates that each replica is isolated from its others. Ensures that no server hosts more than
one replica of the same region (i.e., regions with identical start and end keys).
@param cluster The current state of the cluster.
@return true if all replicas are properly isolated, false otherwise.
hbase-balancer/src/test/java/org/apache/hadoop/hbase/master/balancer/CandidateGeneratorTestUtil.java