Java Code Examples for org.apache.hadoop.hbase.client.Admin#getTableRegions()

The following examples show how to use org.apache.hadoop.hbase.client.Admin#getTableRegions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableSnapshotReadsMapReduceIT.java    From phoenix with Apache License 2.0 5 votes vote down vote up
private void splitTableSync(Admin admin, TableName hbaseTableName,
                            byte[] splitPoint , int expectedRegions) throws IOException, InterruptedException {
  admin.split(hbaseTableName, splitPoint);
  for (int i = 0; i < 100; i++) {
    List<HRegionInfo> hRegionInfoList = admin.getTableRegions(hbaseTableName);
    if (hRegionInfoList.size() >= expectedRegions) {
      break;
    }
    LOGGER.info("Sleeping for 1000 ms while waiting for "
            + hbaseTableName.getNameAsString() + " to split");
    Thread.sleep(1000);
  }
}
 
Example 2
Source File: BaseMRIOTest.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
protected static HRegionLocation getRegionLocation(String conglomId, Admin hBaseAdmin) throws IOException, SQLException {
    TableName tableName = TableName.valueOf("splice",conglomId);
    List<HRegionInfo> tableRegions = hBaseAdmin.getTableRegions(tableName);
    if (tableRegions == null || tableRegions.isEmpty()) {
        return null;
    }
    byte[] encodedRegionNameBytes = tableRegions.get(0).getRegionName();
    return MetaTableAccessor.getRegionLocation(hBaseAdmin.getConnection(), encodedRegionNameBytes);
}