@Override
  protected void regionMoved(int region, int oldServer, int newServer) {
    if (maxCost <= 0) {
      return; // no need to compute
    }
    int oldRack = cluster.serverIndexToRackIndex[oldServer];
    int newRack = cluster.serverIndexToRackIndex[newServer];
    if (newRack != oldRack) {
      costsPerGroup[oldRack] = costPerGroup(cluster.colocatedReplicaCountsPerRack[oldRack]);
      costsPerGroup[newRack] = costPerGroup(cluster.colocatedReplicaCountsPerRack[newRack]);
    }
  }
A cost function for region replicas for the rack distribution. We give a relatively high cost to
hosting replicas of the same region in the same rack. We do not prevent the case though.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionReplicaRackCostFunction.java