CompletableFuture<Void> updateRegionLocation(RegionStateNode regionStateNode) {
    Put put;
    try {
      put = generateUpdateRegionLocationPut(regionStateNode);
    } catch (IOException e) {
      return FutureUtils.failedFuture(e);
    }
    RegionInfo regionInfo = regionStateNode.getRegionInfo();
    State state = regionStateNode.getState();
    CompletableFuture<Void> future = updateRegionLocation(regionInfo, state, put);
    if (regionInfo.isMetaRegion() && regionInfo.isFirst()) {
      // mirror the meta location to zookeeper
      // we store meta location in master local region which means the above method is
      // synchronous(we just wrap the result with a CompletableFuture to make it look like
      // asynchronous), so it is OK to just call this method directly here
      assert future.isDone();
      if (!future.isCompletedExceptionally()) {
        try {
          mirrorMetaLocation(regionInfo, regionStateNode.getRegionLocation(), state);
        } catch (IOException e) {
          return FutureUtils.failedFuture(e);
        }
      }
    }
    return future;
  }
Queries META table for the passed region encoded name, delegating action upon results to the
{@code RegionStateVisitor} passed as second parameter.
@param regionEncodedName encoded name for the Region we want to query META for.
@param visitor           The {@code RegionStateVisitor} instance to react over the query
                         results.
@throws IOException If some error occurs while querying META or parsing results.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStateStore.java