private Map<ServerName, List<RegionInfo>> generateFNForRegionsWithoutFN(
    FavoredNodeAssignmentHelper helper, List<RegionInfo> regions) throws IOException {

    Map<ServerName, List<RegionInfo>> assignmentMap = Maps.newHashMap();
    Map<RegionInfo, List<ServerName>> regionsNoFNMap;

    if (regions.size() > 0) {
      regionsNoFNMap = helper.generateFavoredNodesRoundRobin(assignmentMap, regions);
      fnm.updateFavoredNodes(regionsNoFNMap);
    }
    return assignmentMap;
  }
Round robin assignment: Segregate the regions into two types: 1. The regions that have favored
node assignment where at least one of the favored node is still alive. In this case, try to
adhere to the current favored nodes assignment as much as possible - i.e., if the current
primary is gone, then make the secondary or tertiary as the new host for the region (based on
their current load). Note that we don't change the favored node assignments here (even though
one or more favored node is currently down). That will be done by the admin operations. 2. The
regions that currently don't have favored node assignments. Generate favored nodes for them and
then assign. Generate the primary fn in round robin fashion and generate secondary and tertiary
as per favored nodes constraints.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java