HBASE-7790 Refactor OpenRegionHandler so that the cleanup happens in one place - the finally block; ADDENDUM
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1450333 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4224209d28
commit
b006b61ad5
|
@ -237,52 +237,5 @@ public class TestOpenRegionHandler {
|
|||
assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransitionToFailedOpenFromOffline() throws Exception {
|
||||
Server server = new MockServer(HTU);
|
||||
RegionServerServices rsServices = new MockRegionServerServices(server.getZooKeeper(),
|
||||
server.getServerName());
|
||||
// Create it OFFLINE, which is what it expects
|
||||
ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());
|
||||
// Create the handler
|
||||
OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD) {
|
||||
|
||||
@Override
|
||||
boolean transitionZookeeperOfflineToOpening(String encodedName, int versionOfOfflineNode) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
rsServices.getRegionsInTransitionInRS().put(TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE);
|
||||
|
||||
handler.process();
|
||||
|
||||
RegionTransition rt = RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(),
|
||||
TEST_HRI.getEncodedName()));
|
||||
assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransitionToFailedOpenFromOffline() throws Exception {
|
||||
Server server = new MockServer(HTU);
|
||||
RegionServerServices rsServices = new MockRegionServerServices(server.getZooKeeper(),
|
||||
server.getServerName());
|
||||
// Create it OFFLINE, which is what it expects
|
||||
ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());
|
||||
// Create the handler
|
||||
OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD) {
|
||||
|
||||
@Override
|
||||
boolean transitionZookeeperOfflineToOpening(String encodedName, int versionOfOfflineNode) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
rsServices.getRegionsInTransitionInRS().put(TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE);
|
||||
|
||||
handler.process();
|
||||
|
||||
RegionTransition rt = RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(),
|
||||
TEST_HRI.getEncodedName()));
|
||||
assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue