@Override
  protected void regionMoved(int region, int oldServer, int newServer) {
    cost.applyCostsChange(costs -> {
      if (region == cluster.regionIndexToPrimaryIndex[region]) {
        if (oldServer >= 0) {
          costs[oldServer]--;
        }
        costs[newServer]++;
      }
    });
  }
Compute the cost of a potential cluster state from skew in number of primary regions on a
cluster.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/PrimaryRegionCountSkewCostFunction.java