private int refreshCatalogReplicaCount() {
    int newNumOfReplicas = this.getNumOfReplicas.getAsInt();
    LOG.debug("Refreshed replica count {}", newNumOfReplicas);
    // If the returned number of replicas is -1, it is caused by failure to fetch the
    // replica count. Do not update the numOfReplicas in this case.
    if (newNumOfReplicas == CatalogReplicaLoadBalanceSelector.UNINITIALIZED_NUM_OF_REPLICAS) {
      LOG.error("Failed to fetch Table {}'s region replica count", tableName);
      return this.numOfReplicas;
    }

    int cachedNumOfReplicas = this.numOfReplicas;
    if (
      (cachedNumOfReplicas == UNINITIALIZED_NUM_OF_REPLICAS)
        || (cachedNumOfReplicas != newNumOfReplicas)
    ) {
      this.numOfReplicas = newNumOfReplicas;
    }
    return newNumOfReplicas;
  }
When it looks up a location, it will call this method to find a replica region to go. For a
normal case, > 99% of region locations from catalog/meta replica will be up to date. In extreme
cases such as region server crashes, it will depends on how fast replication catches up.
@param tableName  table name it looks up
@param row        key it looks up.
@param locateType locateType, Only BEFORE and CURRENT will be passed in.
@return catalog replica id
hbase-client/src/main/java/org/apache/hadoop/hbase/client/CatalogReplicaLoadBalanceSimpleSelector.java