public String explainTableAvailability(TableName tableName) throws IOException {
    StringBuilder msg =
      new StringBuilder(explainTableState(tableName, TableState.State.ENABLED)).append(", ");
    if (getHBaseCluster().getMaster().isAlive()) {
      Map<RegionInfo, ServerName> assignments = getHBaseCluster().getMaster().getAssignmentManager()
        .getRegionStates().getRegionAssignments();
      final List<Pair<RegionInfo, ServerName>> metaLocations =
        MetaTableAccessor.getTableRegionsAndLocations(getConnection(), tableName);
      for (Pair<RegionInfo, ServerName> metaLocation : metaLocations) {
        RegionInfo hri = metaLocation.getFirst();
        ServerName sn = metaLocation.getSecond();
        if (!assignments.containsKey(hri)) {
          msg.append(", region ").append(hri)
            .append(" not assigned, but found in meta, it expected to be on ").append(sn);
        } else if (sn == null) {
          msg.append(",  region ").append(hri).append(" assigned,  but has no server in meta");
        } else if (!sn.equals(assignments.get(hri))) {
          msg.append(",  region ").append(hri)
            .append(" assigned,  but has different servers in meta and AM ( ").append(sn)
            .append(" <> ").append(assignments.get(hri));
        }
      }
    }
    return msg.toString();
  }
Wait until all regions in a table have been assigned
@param table         Table to wait on.
@param timeoutMillis Timeout.
hbase-testing-util/src/main/java/org/apache/hadoop/hbase/HBaseTestingUtility.java