Search in sources :

Example 1 with OpenRegionProcedure

use of org.apache.hadoop.hbase.master.assignment.OpenRegionProcedure in project hbase by apache.

the class TestServerRemoteProcedure method testRegionOpenProcedureIsNotHandledByDispatcher.

@Test
public void testRegionOpenProcedureIsNotHandledByDispatcher() throws Exception {
    TableName tableName = TableName.valueOf("testRegionOpenProcedureIsNotHandledByDisPatcher");
    RegionInfo hri = RegionInfoBuilder.newBuilder(tableName).setStartKey(Bytes.toBytes(1)).setEndKey(Bytes.toBytes(2)).setSplit(false).setRegionId(0).build();
    MasterProcedureEnv env = master.getMasterProcedureExecutor().getEnvironment();
    env.getAssignmentManager().getRegionStates().getOrCreateRegionStateNode(hri);
    TransitRegionStateProcedure proc = TransitRegionStateProcedure.assign(env, hri, null);
    ServerName worker = master.getServerManager().getOnlineServersList().get(0);
    OpenRegionProcedure openRegionProcedure = new OpenRegionProcedure(proc, hri, worker);
    Future<byte[]> future = submitProcedure(openRegionProcedure);
    Thread.sleep(2000);
    rsDispatcher.removeNode(worker);
    try {
        future.get(2000, TimeUnit.MILLISECONDS);
        fail();
    } catch (TimeoutException e) {
        LOG.info("timeout is expected");
    }
    Assert.assertFalse(openRegionProcedure.isFinished());
}
Also used : TableName(org.apache.hadoop.hbase.TableName) TransitRegionStateProcedure(org.apache.hadoop.hbase.master.assignment.TransitRegionStateProcedure) ServerName(org.apache.hadoop.hbase.ServerName) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) OpenRegionProcedure(org.apache.hadoop.hbase.master.assignment.OpenRegionProcedure) TimeoutException(java.util.concurrent.TimeoutException) Test(org.junit.Test)

Aggregations

TimeoutException (java.util.concurrent.TimeoutException)1 ServerName (org.apache.hadoop.hbase.ServerName)1 TableName (org.apache.hadoop.hbase.TableName)1 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)1 OpenRegionProcedure (org.apache.hadoop.hbase.master.assignment.OpenRegionProcedure)1 TransitRegionStateProcedure (org.apache.hadoop.hbase.master.assignment.TransitRegionStateProcedure)1 Test (org.junit.Test)1