use of org.apache.hadoop.hbase.master.TableStateManager in project hbase by apache.
the class TestAddToSerialReplicationPeer method testDisablingTable.
@Test
public void testDisablingTable() throws Exception {
TableName tableName = createTable();
try (Table table = UTIL.getConnection().getTable(tableName)) {
for (int i = 0; i < 100; i++) {
table.put(new Put(Bytes.toBytes(i)).addColumn(CF, CQ, Bytes.toBytes(i)));
}
}
UTIL.getAdmin().disableTable(tableName);
rollAllWALs();
TableStateManager tsm = UTIL.getMiniHBaseCluster().getMaster().getTableStateManager();
tsm.setTableState(tableName, TableState.State.DISABLING);
Thread t = new Thread(() -> {
try {
addPeer(true);
} catch (IOException e) {
throw new RuntimeException(e);
}
});
t.start();
Thread.sleep(5000);
// we will wait on the disabling table so the thread should still be alive.
assertTrue(t.isAlive());
tsm.setTableState(tableName, TableState.State.DISABLED);
t.join();
UTIL.getAdmin().enableTable(tableName);
try (Table table = UTIL.getConnection().getTable(tableName)) {
for (int i = 0; i < 100; i++) {
table.put(new Put(Bytes.toBytes(i)).addColumn(CF, CQ, Bytes.toBytes(i)));
}
}
waitUntilReplicationDone(100);
checkOrder(100);
}
Aggregations