public FavoredNodesPlan getNewAssignmentPlan() throws IOException {
    // Get the current region assignment snapshot by scanning from the META
    SnapshotOfRegionAssignmentFromMeta assignmentSnapshot = this.getRegionAssignmentSnapshot();

    // Get the region locality map
    Map<String, Map<String, Float>> regionLocalityMap = null;
    if (this.enforceLocality) {
      regionLocalityMap = FSUtils.getRegionDegreeLocalityMappingFromFS(conf);
    }
    // Initialize the assignment plan
    FavoredNodesPlan plan = new FavoredNodesPlan();

    // Get the table to region mapping
    Map<TableName, List<RegionInfo>> tableToRegionMap = assignmentSnapshot.getTableToRegionMap();
    LOG.info("Start to generate the new assignment plan for the "
      + +tableToRegionMap.keySet().size() + " tables");
    for (TableName table : tableToRegionMap.keySet()) {
      try {
        if (!this.targetTableSet.isEmpty() && !this.targetTableSet.contains(table)) {
          continue;
        }
        // TODO: maybe run the placement in parallel for each table
        genAssignmentPlan(table, assignmentSnapshot, regionLocalityMap, plan,
          USE_MUNKRES_FOR_PLACING_SECONDARY_AND_TERTIARY);
      } catch (Exception e) {
        LOG.error("Get some exceptions for placing primary region server" + "for table " + table
          + " because " + e);
      }
    }
    LOG.info("Finish to generate the new assignment plan for the "
      + +tableToRegionMap.keySet().size() + " tables");
    return plan;
  }
Generate the assignment plan for the existing table
@param munkresForSecondaryAndTertiary if set on true the assignment plan for the tertiary and
                                      secondary will be generated with Munkres algorithm,
                                      otherwise will be generated using
                                      placeSecondaryAndTertiaryRS
hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionPlacementMaintainer.java