private void validate() {
    logger.trace("begin validate.");
    validateClusterName();
    validatePartitionIds();
    validateUniqueness();
    this.allocatedRawCapacityInBytes = calculateAllocatedRawCapacityInBytes();
    this.allocatedUsableCapacityInBytes = calculateAllocatedUsableCapacityInBytes();
    if (localDatacenterName != null && !localDatacenterName.isEmpty()
        && hardwareLayout.findDatacenter(localDatacenterName) == null) {
      throw new IllegalArgumentException("Clustermap has no datacenter named " + localDatacenterName);
    }
    logger.trace("complete validate.");
  }
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