hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
/***
   * HMaster.createTable used to be kind of synchronous call
   * Thus creating of table with lots of regions can cause RPC timeout
   * After the fix to make createTable truly async, RPC timeout shouldn't be an
   * issue anymore
   */
HMaster.createTable used to be kind of synchronous call
Thus creating of table with lots of regions can cause RPC timeout
After the fix to make createTable truly async, RPC timeout shouldn't be an
issue anymore
HMaster . createTable used to be kind of synchronous call Thus creating of table with lots of regions can cause RPC timeout After the fix to make createTable truly async RPC timeout shouldn ' t be an issue anymore
@Test
  public void testCreateTableRPCTimeOut() throws Exception {
    final String name = this.name.getMethodName();
    int oldTimeout = TEST_UTIL.getConfiguration().
      getInt(HConstants.HBASE_RPC_TIMEOUT_KEY, HConstants.DEFAULT_HBASE_RPC_TIMEOUT);
    TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 1500);
    try {
      int expectedRegions = 100;
      byte [] startKey = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
      byte [] endKey =   { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 };
      Admin hbaseadmin = TEST_UTIL.getAdmin();
      HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(name));
      htd.addFamily(new HColumnDescriptor(HConstants.CATALOG_FAMILY));
      hbaseadmin.createTable(htd, startKey, endKey, expectedRegions);
    } finally {
      TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, oldTimeout);
    }
  }
@ Test public void testCreateTableRPCTimeOut ( ) throws Exception { final String name = this . name . getMethodName ( ) ; int oldTimeout = TEST_UTIL . getConfiguration ( ) . getInt ( HConstants . HBASE_RPC_TIMEOUT_KEY , HConstants . DEFAULT_HBASE_RPC_TIMEOUT ) ; TEST_UTIL . getConfiguration ( ) . setInt ( HConstants . HBASE_RPC_TIMEOUT_KEY , 1500 ) ; try { int expectedRegions = 100 ; byte [ ] startKey = { 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 } ; byte [ ] endKey = { 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 } ; Admin hbaseadmin = TEST_UTIL . getAdmin ( ) ; HTableDescriptor htd = new HTableDescriptor ( TableName . valueOf ( name ) ) ; htd . addFamily ( new HColumnDescriptor ( HConstants . CATALOG_FAMILY ) ) ; hbaseadmin . createTable ( htd , startKey , endKey , expectedRegions ) ; } finally { TEST_UTIL . getConfiguration ( ) . setInt ( HConstants . HBASE_RPC_TIMEOUT_KEY , oldTimeout ) ; } }
HMaster.createTable used to be kind of synchronous call
 Thus creating of table with lots of regions can cause RPC timeout
 After the fix to make createTable truly async, RPC timeout shouldn't be an
 issue anymore
HMaster . createTable used to be kind of synchronous call Thus creating of table with lots of regions can cause RPC timeout After the fix to make createTable truly async RPC timeout shouldn ' t be an issue anymore
// Use 80 bit numbers to make sure we aren't limited