use of org.apache.hadoop.hbase.regionserver.HRegionServer in project hbase by apache.
the class TestFromClientSide3 method find.
private static HRegion find(final TableName tableName) throws IOException, InterruptedException {
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(tableName);
List<HRegion> regions = rs.getRegions(tableName);
assertEquals(1, regions.size());
return regions.get(0);
}
use of org.apache.hadoop.hbase.regionserver.HRegionServer in project hbase by apache.
the class TestFlushFromClient method testFlushRegionServer.
@Test
public void testFlushRegionServer() throws Exception {
try (Admin admin = TEST_UTIL.getAdmin()) {
for (HRegionServer rs : TEST_UTIL.getHBaseCluster().getLiveRegionServerThreads().stream().map(JVMClusterUtil.RegionServerThread::getRegionServer).collect(Collectors.toList())) {
admin.flushRegionServer(rs.getServerName());
assertFalse(getRegionInfo(rs).stream().anyMatch(r -> r.getMemStoreDataSize() != 0));
}
}
}
use of org.apache.hadoop.hbase.regionserver.HRegionServer in project hbase by apache.
the class TestFlushFromClient method testAsyncFlushRegionServer.
@Test
public void testAsyncFlushRegionServer() throws Exception {
AsyncAdmin admin = asyncConn.getAdmin();
for (HRegionServer rs : TEST_UTIL.getHBaseCluster().getLiveRegionServerThreads().stream().map(JVMClusterUtil.RegionServerThread::getRegionServer).collect(Collectors.toList())) {
admin.flushRegionServer(rs.getServerName()).get();
assertFalse(getRegionInfo(rs).stream().anyMatch(r -> r.getMemStoreDataSize() != 0));
}
}
use of org.apache.hadoop.hbase.regionserver.HRegionServer in project hbase by apache.
the class TestFavoredStochasticBalancerPickers method getTableRegionsFromServer.
private List<RegionInfo> getTableRegionsFromServer(TableName tableName, ServerName source) throws IOException {
List<RegionInfo> regionInfos = Lists.newArrayList();
HRegionServer regionServer = cluster.getRegionServer(source);
for (Region region : regionServer.getRegions(tableName)) {
regionInfos.add(region.getRegionInfo());
}
return regionInfos;
}
use of org.apache.hadoop.hbase.regionserver.HRegionServer in project hbase by apache.
the class TestExceptionInAssignRegion method testExceptionInAssignRegion.
@Test
public void testExceptionInAssignRegion() {
ProcedureExecutor procedureExecutor = UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor();
JVMClusterUtil.RegionServerThread rsThread = null;
for (JVMClusterUtil.RegionServerThread t : UTIL.getMiniHBaseCluster().getRegionServerThreads()) {
if (!t.getRegionServer().getRegions(TABLE_NAME).isEmpty()) {
rsThread = t;
break;
}
}
// find the rs and hri of the table
HRegionServer rs = rsThread.getRegionServer();
RegionInfo hri = rs.getRegions(TABLE_NAME).get(0).getRegionInfo();
TransitRegionStateProcedure assignRegionProcedure = TransitRegionStateProcedure.move(UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor().getEnvironment(), hri, null);
RegionStateNode regionNode = UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager().getRegionStates().getOrCreateRegionStateNode(hri);
regionNode.setProcedure(assignRegionProcedure);
countDownLatch.countDown();
long prodId = procedureExecutor.submitProcedure(assignRegionProcedure);
ProcedureTestingUtility.waitProcedure(procedureExecutor, prodId);
Assert.assertEquals("Should be two RS since other is aborted", 2, UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size());
Assert.assertNull("RIT Map doesn't have correct value", getRegionServer(0).getRegionsInTransitionInRS().get(hri.getEncodedNameAsBytes()));
Assert.assertNull("RIT Map doesn't have correct value", getRegionServer(1).getRegionsInTransitionInRS().get(hri.getEncodedNameAsBytes()));
Assert.assertNull("RIT Map doesn't have correct value", getRegionServer(2).getRegionsInTransitionInRS().get(hri.getEncodedNameAsBytes()));
}
Aggregations