HBASE-4075 A bug in TestZKBasedOpenCloseRegion

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1145927 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-07-13 09:23:56 +00:00
parent edf2b7901a
commit 3314b87804
2 changed files with 26 additions and 25 deletions

View File

@ -159,6 +159,7 @@ Release 0.91.0 - Unreleased
HBASE-4077 Deadlock if WrongRegionException is thrown from getLock in
HRegion.delete (Adam Warrington via Ted Yu)
HBASE-3893 HRegion.internalObtainRowLock shouldn't wait forever
HBASE-4075 A bug in TestZKBasedOpenCloseRegion (Jieshan Bean via Ted Yu)
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -188,31 +188,6 @@ public class TestZKBasedOpenCloseRegion {
}
}
@Test (timeout=300000) public void testCloseRegion()
throws Exception {
LOG.info("Running testCloseRegion");
MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
LOG.info("Number of region servers = " + cluster.getLiveRegionServerThreads().size());
int rsIdx = 0;
HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(rsIdx);
HRegionInfo hri = getNonMetaRegion(regionServer.getOnlineRegions());
LOG.debug("Asking RS to close region " + hri.getRegionNameAsString());
AtomicBoolean closeEventProcessed = new AtomicBoolean(false);
EventHandlerListener listener =
new CloseRegionEventListener(hri.getRegionNameAsString(),
closeEventProcessed);
cluster.getMaster().executorService.registerListener(EventType.RS_ZK_REGION_CLOSED, listener);
cluster.getMaster().assignmentManager.unassign(hri);
while (!closeEventProcessed.get()) {
Threads.sleep(100);
}
LOG.info("Done with testCloseRegion");
}
public static class CloseRegionEventListener implements EventHandlerListener {
private static final Log LOG = LogFactory.getLog(CloseRegionEventListener.class);
String regionToClose;
@ -301,6 +276,31 @@ public class TestZKBasedOpenCloseRegion {
}
@Test (timeout=300000) public void testCloseRegion()
throws Exception {
LOG.info("Running testCloseRegion");
MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
LOG.info("Number of region servers = " + cluster.getLiveRegionServerThreads().size());
int rsIdx = 0;
HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(rsIdx);
HRegionInfo hri = getNonMetaRegion(regionServer.getOnlineRegions());
LOG.debug("Asking RS to close region " + hri.getRegionNameAsString());
AtomicBoolean closeEventProcessed = new AtomicBoolean(false);
EventHandlerListener listener =
new CloseRegionEventListener(hri.getRegionNameAsString(),
closeEventProcessed);
cluster.getMaster().executorService.registerListener(EventType.RS_ZK_REGION_CLOSED, listener);
cluster.getMaster().assignmentManager.unassign(hri);
while (!closeEventProcessed.get()) {
Threads.sleep(100);
}
LOG.info("Done with testCloseRegion");
}
private static void waitUntilAllRegionsAssigned()
throws IOException {
HTable meta = new HTable(TEST_UTIL.getConfiguration(),