private void validateUniqueness() {
    // Validate uniqueness of each logical component. Partition uniqueness is validated by method addPartition.
    Set<ReplicaId> replicaSet = new HashSet<>();

    for (Partition partition : partitionMap.values()) {
      for (ReplicaId replica : partition.getReplicaIds()) {
        if (!replicaSet.add(replica)) {
          throw new IllegalStateException("Duplicate Replica detected: " + replica.toString());
        }
      }
    }
  }
Adds Partition to and validates Partition is unique. A duplicate Partition results in an exception.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/PartitionLayout.java