private CompletableFuture<Void> updateRegionLocation(RegionInfo regionInfo, State state,
    Put put) {
    CompletableFuture<Void> future;
    if (regionInfo.isMetaRegion()) {
      try {
        masterRegion.update(r -> r.put(put));
        future = CompletableFuture.completedFuture(null);
      } catch (Exception e) {
        future = FutureUtils.failedFuture(e);
      }
    } else {
      AsyncTable<?> table = master.getAsyncConnection().getTable(TableName.META_TABLE_NAME);
      future = table.put(put);
    }
    FutureUtils.addListener(future, (r, e) -> {
      if (e != null) {
        // TODO: Revist!!!! Means that if a server is loaded, then we will abort our host!
        // In tests we abort the Master!
        String msg = String.format("FAILED persisting region=%s state=%s",
          regionInfo.getShortNameToLog(), state);
        LOG.error(msg, e);
        master.abort(msg, 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