@Override
  public boolean removeReplicasFromDataNode(List<ReplicaId> replicaIds) {
    if (!clusterMapConfig.clustermapUpdateDatanodeInfo) {
      return false;
    }
    if (replicaIds == null) {
      throw new IllegalArgumentException("Invalid replica list to remove");
    }
    synchronized (helixAdministrationLock) {
      DataNodeConfig dataNodeConfig = getDataNodeConfig();
      boolean dataNodeConfigUpdated = false;
      boolean removalResult = true;
      List<String> partitionNames = new ArrayList<>();
      for (ReplicaId replicaId : replicaIds) {
        String partitionName = replicaId.getPartitionId().toPathString();
        boolean removedFromStopped = dataNodeConfig.getStoppedReplicas().remove(partitionName);
        boolean removedFromSealed = dataNodeConfig.getSealedReplicas().remove(partitionName);
        boolean update = false;
        if (removedFromStopped || removedFromSealed) {
          logger.info("Removing partition {} from stopped and sealed list", partitionName);
          dataNodeConfigUpdated = true;
          update = true;
        }
        DataNodeConfig.DiskConfig diskConfig = dataNodeConfig.getDiskConfigs().get(replicaId.getMountPath());
        if (diskConfig != null && diskConfig.getReplicaConfigs().remove(partitionName) != null) {
          logger.info("Removing partition {} from disk {}' config list", partitionName, replicaId.getMountPath());
          dataNodeConfigUpdated = true;
          update = true;
        }
        if (update) {
          partitionNames.add(partitionName);
        }
      }
      if (dataNodeConfigUpdated) {
        logger.info("Updating config in Helix by removing partitions {}", partitionNames);
        removalResult = dataNodeConfigSource.set(dataNodeConfig);
      } else {
        logger.warn("Partitions {} is not found on instance {}, skipping removing them from config in Helix.",
            partitionNames, instanceName);
      }
      return removalResult;
    }
  }
@return list of stopped replicas from HelixAdmin
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixParticipant.java