use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestAdmin2 method testMoveToPreviouslyAssignedRS.
@Test
public void testMoveToPreviouslyAssignedRS() throws IOException, InterruptedException {
SingleProcessHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
HMaster master = cluster.getMaster();
final TableName tableName = TableName.valueOf(name.getMethodName());
Admin localAdmin = createTable(tableName);
List<RegionInfo> tableRegions = localAdmin.getRegions(tableName);
RegionInfo hri = tableRegions.get(0);
AssignmentManager am = master.getAssignmentManager();
ServerName server = am.getRegionStates().getRegionServerOfRegion(hri);
localAdmin.move(hri.getEncodedNameAsBytes(), server);
assertEquals("Current region server and region server before move should be same.", server, am.getRegionStates().getRegionServerOfRegion(hri));
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestCleanupMetaReplicaThroughConfig method testReplicaCleanup.
@Test
public void testReplicaCleanup() throws Exception {
ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher();
List<String> metaReplicaZnodes = zkw.getMetaReplicaNodes();
assertEquals(3, metaReplicaZnodes.size());
final HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
master.stop("Restarting");
TEST_UTIL.waitFor(30000, () -> master.isStopped());
TEST_UTIL.getMiniHBaseCluster().getConfiguration().setInt(HConstants.META_REPLICAS_NUM, 1);
JVMClusterUtil.MasterThread newMasterThread = TEST_UTIL.getMiniHBaseCluster().startMaster();
final HMaster newMaster = newMasterThread.getMaster();
// wait until new master finished meta replica assignment logic
TEST_UTIL.waitFor(30000, () -> newMaster.getMasterQuotaManager() != null);
TEST_UTIL.waitFor(30000, () -> TEST_UTIL.getZooKeeperWatcher().getMetaReplicaNodes().size() == 1);
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestTransitRegionStateProcedure method testRecoveryAndDoubleExcution.
private void testRecoveryAndDoubleExcution(TransitRegionStateProcedure proc) throws Exception {
HMaster master = UTIL.getHBaseCluster().getMaster();
AssignmentManager am = master.getAssignmentManager();
RegionStateNode regionNode = am.getRegionStates().getRegionStateNode(proc.getRegion());
assertFalse(regionNode.isInTransition());
regionNode.setProcedure(proc);
assertTrue(regionNode.isInTransition());
ProcedureExecutor<MasterProcedureEnv> procExec = master.getMasterProcedureExecutor();
ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);
long procId = procExec.submitProcedure(proc);
MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId);
regionNode = am.getRegionStates().getRegionStateNode(proc.getRegion());
assertFalse(regionNode.isInTransition());
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestRegionServerCrashDisableWAL method test.
@Test
public void test() throws InterruptedException, IOException {
HMaster master = UTIL.getMiniHBaseCluster().stopMaster(0).getMaster();
// Shutdown master before shutting down rs
UTIL.waitFor(30000, () -> !master.isAlive());
RegionServerThread thread = null;
for (RegionServerThread t : UTIL.getMiniHBaseCluster().getRegionServerThreads()) {
if (!t.getRegionServer().getRegions(TABLE_NAME).isEmpty()) {
thread = t;
break;
}
}
// shutdown rs
thread.getRegionServer().abort("For testing");
thread.join();
// restart master
UTIL.getMiniHBaseCluster().startMaster();
// the region online.
try (Table table = UTIL.getConnection().getTableBuilder(TABLE_NAME, null).setOperationTimeout(30000).build()) {
table.put(new Put(Bytes.toBytes(1)).addColumn(CF, CQ, Bytes.toBytes(1)));
assertEquals(1, Bytes.toInt(table.get(new Get(Bytes.toBytes(1))).getValue(CF, CQ)));
}
}
use of org.apache.hadoop.hbase.master.HMaster in project hbase by apache.
the class TestMasterFifoRpcScheduler method testMasterRpcScheduler.
@Test
public void testMasterRpcScheduler() {
HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
MasterRpcServices masterRpcServices = master.getMasterRpcServices();
RpcScheduler masterRpcScheduler = masterRpcServices.getRpcScheduler();
Assert.assertTrue(masterRpcScheduler instanceof MasterFifoRpcScheduler);
}
Aggregations