private void checkRegionIsOpened(HRegionInfo hri) throws Exception { while (!getRS().getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } }
public static void checkRegionIsClosed(HBaseTestingUtility HTU, HRegionServer rs, HRegionInfo hri) throws Exception { while (!rs.getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } try { Assert.assertFalse(rs.getRegion(hri.getRegionName()).isAvailable()); } catch (NotServingRegionException expected) { // That's how it work: if the region is closed we have an exception. } }
public static void checkRegionIsOpened(HBaseTestingUtility HTU, HRegionServer rs, HRegionInfo hri) throws Exception { while (!rs.getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } Assert.assertTrue(rs.getRegion(hri.getRegionName()).isAvailable()); }
private void checkRegionIsClosed(String encodedRegionName) throws Exception { while (!getRS().getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } try { Assert.assertFalse(getRS().getRegionByEncodedName(encodedRegionName).isAvailable()); } catch (NotServingRegionException expected) { // That's how it work: if the region is closed we have an exception. } // We don't delete the znode here, because there is not always a znode. }
if (regionServer.getRegionsInTransitionInRS().containsKey(encodedNameBytes)) { LOG.info("Region is in transition. Skipping warmup " + region); return response;
/** * Test that if we do a close while opening it stops the opening. */ @Test public void testCancelOpeningWithoutZK() throws Exception { // We close closeRegionNoZK(); checkRegionIsClosed(HTU, getRS(), hri); // Let do the initial steps, without having a handler getRS().getRegionsInTransitionInRS().put(hri.getEncodedNameAsBytes(), Boolean.TRUE); // That's a close without ZK. AdminProtos.CloseRegionRequest crr = ProtobufUtil.buildCloseRegionRequest(getRS().getServerName(), regionName); try { getRS().rpcServices.closeRegion(null, crr); Assert.assertTrue(false); } catch (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException expected) { } // The state in RIT should have changed to close Assert.assertEquals(Boolean.FALSE, getRS().getRegionsInTransitionInRS().get( hri.getEncodedNameAsBytes())); // Let's start the open handler TableDescriptor htd = getRS().tableDescriptors.get(hri.getTable()); getRS().executorService.submit(new OpenRegionHandler(getRS(), getRS(), hri, htd, -1)); // The open handler should have removed the region from RIT but kept the region closed checkRegionIsClosed(HTU, getRS(), hri); openRegion(HTU, getRS(), hri); }
destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || curServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || master.getAssignmentManager().hasRegionsInTransition()) { Assert.assertFalse(destServer.getRegionsInTransitionInRS() .containsKey(encodedRegionNameBytes)); Assert.assertFalse(curServer.getRegionsInTransitionInRS() .containsKey(encodedRegionNameBytes));
destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || curServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || master.getAssignmentManager().hasRegionsInTransition()) { Assert.assertFalse(destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes)); Assert.assertFalse(curServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes)); conn.getCachedLocation(TABLE_NAME, ROW).getRegionLocation().getPort()); Assert.assertFalse(destServer.getRegionsInTransitionInRS() .containsKey(encodedRegionNameBytes)); Assert.assertFalse(curServer.getRegionsInTransitionInRS() .containsKey(encodedRegionNameBytes)); destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || curServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || master.getAssignmentManager().hasRegionsInTransition()) {
/** * Ensures each region of SYSTEM.CATALOG is on a different region server */ private static void moveRegion(HRegionInfo regionInfo, ServerName srcServerName, ServerName dstServerName) throws Exception { Admin admin = driver.getConnectionQueryServices(getUrl(), TestUtil.TEST_PROPERTIES).getAdmin(); HBaseTestingUtility util = getUtility(); MiniHBaseCluster cluster = util.getHBaseCluster(); HMaster master = cluster.getMaster(); AssignmentManager am = master.getAssignmentManager(); HRegionServer dstServer = util.getHBaseCluster().getRegionServer(dstServerName); HRegionServer srcServer = util.getHBaseCluster().getRegionServer(srcServerName); byte[] encodedRegionNameInBytes = regionInfo.getEncodedNameAsBytes(); admin.move(encodedRegionNameInBytes, Bytes.toBytes(dstServer.getServerName().getServerName())); while (dstServer.getOnlineRegion(regionInfo.getRegionName()) == null || dstServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameInBytes) || srcServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameInBytes)) { // wait for the move to be finished Thread.sleep(100); } } }
admin.move(encodedRegionNameInBytes, Bytes.toBytes(dstServer.getServerName().getServerName())); while (dstServer.getOnlineRegion(hri2.getRegionName()) == null || dstServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameInBytes) || srcServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameInBytes) || master.getAssignmentManager().getRegionStates().isRegionInTransition(hri2)) {
private void checkRegionIsOpened(HRegionInfo hri) throws Exception { while (!getRS().getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } }
public static void checkRegionIsOpened(HBaseTestingUtility HTU, HRegionServer rs, HRegionInfo hri) throws Exception { while (!rs.getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } Assert.assertTrue(rs.getRegion(hri.getRegionName()).isAvailable()); }
public static void checkRegionIsClosed(HBaseTestingUtility HTU, HRegionServer rs, HRegionInfo hri) throws Exception { while (!rs.getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } try { Assert.assertFalse(rs.getRegion(hri.getRegionName()).isAvailable()); } catch (NotServingRegionException expected) { // That's how it work: if the region is closed we have an exception. } }
private void checkRegionIsClosed(String encodedRegionName) throws Exception { while (!getRS().getRegionsInTransitionInRS().isEmpty()) { Thread.sleep(1); } try { Assert.assertFalse(getRS().getRegionByEncodedName(encodedRegionName).isAvailable()); } catch (NotServingRegionException expected) { // That's how it work: if the region is closed we have an exception. } // We don't delete the znode here, because there is not always a znode. }
if (regionServer.getRegionsInTransitionInRS().containsKey(encodedNameBytes)) { LOG.info("Region is in transition. Skipping warmup " + region); return response;
/** * Test that if we do a close while opening it stops the opening. */ @Test public void testCancelOpeningWithoutZK() throws Exception { // We close closeRegionNoZK(); checkRegionIsClosed(HTU, getRS(), hri); // Let do the initial steps, without having a handler getRS().getRegionsInTransitionInRS().put(hri.getEncodedNameAsBytes(), Boolean.TRUE); // That's a close without ZK. AdminProtos.CloseRegionRequest crr = ProtobufUtil.buildCloseRegionRequest(getRS().getServerName(), regionName); try { getRS().rpcServices.closeRegion(null, crr); Assert.assertTrue(false); } catch (org.apache.hbase.thirdparty.com.google.protobuf.ServiceException expected) { } // The state in RIT should have changed to close Assert.assertEquals(Boolean.FALSE, getRS().getRegionsInTransitionInRS().get( hri.getEncodedNameAsBytes())); // Let's start the open handler TableDescriptor htd = getRS().tableDescriptors.get(hri.getTable()); getRS().executorService.submit(new OpenRegionHandler(getRS(), getRS(), hri, htd, -1)); // The open handler should have removed the region from RIT but kept the region closed checkRegionIsClosed(HTU, getRS(), hri); openRegion(HTU, getRS(), hri); }
destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || curServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || master.getAssignmentManager().hasRegionsInTransition()) { Assert.assertFalse(destServer.getRegionsInTransitionInRS() .containsKey(encodedRegionNameBytes)); Assert.assertFalse(curServer.getRegionsInTransitionInRS() .containsKey(encodedRegionNameBytes));
destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || curServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || master.getAssignmentManager().hasRegionsInTransition()) { Assert.assertFalse(destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes)); Assert.assertFalse(curServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes)); conn.getCachedLocation(TABLE_NAME, ROW).getRegionLocation().getPort()); Assert.assertFalse(destServer.getRegionsInTransitionInRS() .containsKey(encodedRegionNameBytes)); Assert.assertFalse(curServer.getRegionsInTransitionInRS() .containsKey(encodedRegionNameBytes)); destServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || curServer.getRegionsInTransitionInRS().containsKey(encodedRegionNameBytes) || master.getAssignmentManager().hasRegionsInTransition()) {