static RegionLocations replaceRegionLocation(RegionLocations oldLocs, HRegionLocation loc) {
    int replicaId = loc.getRegion().getReplicaId();
    HRegionLocation[] locs = oldLocs.getRegionLocations();
    locs = Arrays.copyOf(locs, Math.max(replicaId + 1, locs.length));
    locs[replicaId] = loc;
    return new RegionLocations(locs);
  }
Create a new {@link RegionLocations} based on the given {@code oldLocs}, and replace the
location for the given {@code replicaId} with the given {@code loc}.
<p/>
All the {@link RegionLocations} in async locator related class are immutable because we want to
access them concurrently, so here we need to create a new one, instead of calling
{@link RegionLocations#updateLocation(HRegionLocation, boolean, boolean)}.
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java