HBASE-7866 - TestSplitTransactionOnCluster.testSplitBeforeSettingSplittingInZK failed 3 times in a row (Ram)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1449101 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ramkrishna 2013-02-22 16:24:36 +00:00
parent dac024559d
commit eff9b82421
1 changed files with 25 additions and 3 deletions

View File

@ -743,15 +743,31 @@ public class TestSplitTransactionOnCluster {
@Override
int createNodeSplitting(ZooKeeperWatcher zkw, HRegionInfo region, ServerName serverName)
throws KeeperException, IOException {
throw new IOException();
throw new SplittingNodeCreationFailedException ();
}
};
}
String node = ZKAssign.getNodeName(regionServer.getZooKeeper(), regions.get(0)
.getRegionInfo().getEncodedName());
regionServer.getZooKeeper().sync(node);
for (int i = 0; i < 100; i++) {
// We expect the znode to be deleted by this time. Here the
// znode could be in OPENED state and the
// master has not yet deleted the znode.
if (ZKUtil.checkExists(regionServer.getZooKeeper(), node) != -1) {
Thread.sleep(100);
}
}
try {
st.execute(regionServer, regionServer);
} catch (IOException e) {
String node = ZKAssign.getNodeName(regionServer.getZooKeeper(), regions.get(0)
.getRegionInfo().getEncodedName());
// check for the specific instance in case the Split failed due to the
// existence of the znode in OPENED state.
// This will at least make the test to fail;
assertTrue("Should be instance of CreateSplittingNodeFailedException",
e instanceof SplittingNodeCreationFailedException );
node = ZKAssign.getNodeName(regionServer.getZooKeeper(), regions.get(0).getRegionInfo()
.getEncodedName());
{
assertTrue(ZKUtil.checkExists(regionServer.getZooKeeper(), node) == -1);
}
@ -979,5 +995,11 @@ public class TestSplitTransactionOnCluster {
}
}
private static class SplittingNodeCreationFailedException extends IOException {
public SplittingNodeCreationFailedException () {
super();
}
}
}