private boolean externalViewHasInstanceForPartition(ExternalView externalView, String dcName,
        String partitionName) {
      if (externalView == null) {
        return false;
      }
      Map<String, String> stateMap = externalView.getStateMap(partitionName);
      if (stateMap == null || stateMap.isEmpty()) {
        return false;
      }
      // state map is a map from instance to state
      return stateMap.keySet().stream().anyMatch(instance -> {
        AmbryDataNode dataNode = instanceNameToAmbryDataNode.get(instance);
        return dataNode != null && dataNode.getDatacenterName().equals(dcName);
      });
    }
{@inheritDoc}
If dcName is null, then get replicas by given state from all datacenters.
If no routing table snapshot is found for dc name, or no resource name found for given partition, return empty list.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixClusterManager.java