private void getSealedPartitionsInDc(Datacenter dc, Map<String, Set<String>> dcToSealedPartitions,
      Map<String, Set<String>> nodeToNonExistentReplicas) {
    String dcName = dc.getName();
    dcToSealedPartitions.put(dcName, new HashSet<>());
    ClusterMapConfig config = getClusterMapConfig(clusterName, dcName, null);
    String zkConnectStr = dataCenterToZkAddress.get(dcName).getZkConnectStrs().get(0);
    try (PropertyStoreToDataNodeConfigAdapter propertyStoreAdapter = new PropertyStoreToDataNodeConfigAdapter(
        zkConnectStr, config)) {
      InstanceConfigToDataNodeConfigAdapter.Converter instanceConfigConverter =
          new InstanceConfigToDataNodeConfigAdapter.Converter(config);
      Set<String> allInstancesInHelix = new HashSet<>(getInstanceNamesInHelix(dcName, propertyStoreAdapter));
      for (DataNodeId dataNodeId : dc.getDataNodes()) {
        DataNode dataNode = (DataNode) dataNodeId;
        Set<String> replicasOnNode = staticClusterMap.getReplicas(dataNode)
            .stream()
            .map(replicaId -> replicaId.getPartitionId().toPathString())
            .collect(Collectors.toSet());
        String instanceName = getInstanceName(dataNode);
        ensureOrThrow(allInstancesInHelix.contains(instanceName), "Instance not present in Helix " + instanceName);
        DataNodeConfig dataNodeConfig =
            getDataNodeConfigFromHelix(clusterName, instanceName, propertyStoreAdapter, instanceConfigConverter,
                adminForDc.get(dcName), dataNodeConfigSourceType);
        Set<String> sealedReplicas = dataNodeConfig.getSealedReplicas();
        if (sealedReplicas != null) {
          for (String sealedReplica : sealedReplicas) {
            info("Replica {} is sealed on {}", sealedReplica, instanceName);
            dcToSealedPartitions.get(dcName).add(sealedReplica);
            if (!replicasOnNode.contains(sealedReplica)) {
              logger.warn("Replica {} is in sealed list but not on node {}", sealedReplica, instanceName);
              nodeToNonExistentReplicas.computeIfAbsent(instanceName, key -> new HashSet<>()).add(sealedReplica);
            }
          }
        }
      }
    }
  }
Get sealed partitions from given datacenter.
@param dc the datacenter where sealed partitions come from.
@param dcToSealedPartitions a map to track sealed partitions in each dc. This entry associated with given dc will
                            be populated in this method.
@param nodeToNonExistentReplicas a map to track if any replica is in sealed list but not actually on local node.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixBootstrapUpgradeUtil.java