private synchronized ReplicaId getBootstrapReplicaInFullAuto(String partitionIdStr, DataNodeId dataNodeId) {
    long replicaCapacity;
    AmbryPartition ambryPartition;
    if (!partitionNameToAmbryPartition.containsKey(partitionIdStr)) {
      ambryPartition =
          new AmbryPartition(Long.parseLong(partitionIdStr), clusterMapConfig.clusterMapDefaultPartitionClass,
              helixClusterManagerQueryHelper);
      // If the partition is new, we get the default replica capacity from config
      replicaCapacity = clusterMapConfig.clustermapDefaultReplicaCapacityInBytes;
      logger.info("Partition {} is currently not present in cluster map, creating first replica with capacity {} ",
          partitionIdStr, replicaCapacity);
    } else {
      ambryPartition = partitionNameToAmbryPartition.get(partitionIdStr);
      // For existing partitions, we should already have other replicas in the map
      replicaCapacity = ambryPartition.getReplicaIds().get(0).getCapacityInBytes();
      logger.info("Partition {} is already present in cluster map, creating replica with capacity {} ", partitionIdStr,
          replicaCapacity);
    }

    try {
      AmbryDisk disk = getDiskForBootstrapReplica((AmbryDataNode) dataNodeId, replicaCapacity, partitionIdStr);
      if (disk == null) {
        logger.error("Failed to create bootstrap replica for partition {} due to insufficient disk space",
            partitionIdStr);
        return null;
      }
      addPartitionIfAbsent(ambryPartition, replicaCapacity);
      AmbryServerReplica replica = new AmbryServerReplica(clusterMapConfig, ambryPartition, disk, true, replicaCapacity,
          ReplicaSealStatus.NOT_SEALED);
      logger.info("Created bootstrap replica {} for Partition {}", replica, partitionIdStr);
      Thread currentThread = Thread.currentThread();
      // TODO: Remove this code after figuring out why ReplicaThread is calling this method.
      if (currentThread.getName().contains("ReplicaThread")) {
        logger.error("Method invocation in wrong thread {}", currentThread.getName(), new Exception(""));
      }
      disk.decreaseAvailableSpaceInBytes(replicaCapacity);
      return replica;
    } catch (Exception e) {
      logger.error("Failed to create bootstrap replica for partition {} on {} due to exception: ", partitionIdStr,
          dataNodeId, e);
      return null;
    }
  }
Gets bootstrap replica in Helix full auto mode. Since helix can add multiple replicas simultaneously, synchronizing
this method to avoid over-allocating a disk.
@param partitionIdStr the partition id string
@param dataNodeId the {@link DataNodeId} on which bootstrap replica is placed
@return {@link ReplicaId} if there is a new replica satisfying given partition and data node. {@code null} otherwise.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixClusterManager.java