boolean shouldTransition(Message message) {
    String resourceName = message.getResourceName();
    String partitionName = message.getPartitionName();
    Set<String> resourceNamesToCompare = clusterManager.getResourceForPartitionInLocalDc(partitionName);
    if (resourceNamesToCompare == null || resourceNamesToCompare.isEmpty()) {
      // this is a new partition, clustermap didn't get the update yet, then just allow transition.
      return true;
    }
    if (resourceNamesToCompare.contains(resourceName)) {
      // Resource name is one of the legit resource in clustermap.
      return true;
    }
    // If the resource name is lower than all the resource names in the clustermap, then don't allow it.
    for (String resourceNameToCompare : resourceNamesToCompare) {
      if (Integer.valueOf(resourceNameToCompare) < Integer.valueOf(resourceName)) {
        return true;
      }
    }
    return false;
  }
Return true if we should transition the state from the message. Ambry is undergoing resource reconstruction. Same
partition will be added to different resources. Resource that has higher id should be considered as the primary
resource.
@param message Message that carry partition information.
@return True if a state transition should happen.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/AmbryPartitionStateModel.java