private boolean addNewReplicaInfo(ReplicaId replicaId) {
    boolean additionResult = true;
    DataNodeConfig dataNodeConfig = getDataNodeConfig();
    String partitionName = replicaId.getPartitionId().toPathString();
    DataNodeConfig.ReplicaConfig replicaConfigToAdd = new DataNodeConfig.ReplicaConfig(replicaId.getCapacityInBytes(),
        replicaId.getPartitionId().getPartitionClass());
    DataNodeConfig.DiskConfig diskConfig = dataNodeConfig.getDiskConfigs().get(replicaId.getMountPath());
    boolean newReplicaInfoAdded = false;
    if (diskConfig != null) {
      // add replica to an existing disk
      if (diskConfig.getReplicaConfigs().containsKey(partitionName)) {
        logger.info("Partition {} is already on instance {}, skipping adding it into configs in Helix.", partitionName,
            instanceName);
      } else {
        diskConfig.getReplicaConfigs().put(partitionName, replicaConfigToAdd);
        newReplicaInfoAdded = true;
      }
    } else {
      // add replica onto a brand new disk
      logger.info("Adding info of new replica {} to the new disk {}", replicaId.getPartitionId().toPathString(),
          replicaId.getDiskId());
      DataNodeConfig.DiskConfig diskConfigToAdd =
          new DataNodeConfig.DiskConfig(HardwareState.AVAILABLE, replicaId.getDiskId().getRawCapacityInBytes());
      diskConfigToAdd.getReplicaConfigs().put(partitionName, replicaConfigToAdd);
      dataNodeConfig.getDiskConfigs().put(replicaId.getMountPath(), diskConfigToAdd);
      newReplicaInfoAdded = true;
    }
    if (newReplicaInfoAdded) {
      logger.info("Updating config in Helix by adding partition {}", partitionName);
      additionResult = dataNodeConfigSource.set(dataNodeConfig);
    }
    return additionResult;
  }
Add new replica info into {@link DataNodeConfig} of current data node.
@param replicaId new replica whose info should be added into {@link DataNodeConfig}.
@return {@code true} replica info is successfully added. {@code false} otherwise.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixParticipant.java