HBASE-19555 TestSplitTransactionOnCluster is flaky

Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
Peter Somogyi 2017-12-19 15:04:38 +01:00 committed by tedyu
parent 03e79b7994
commit dbe409e2c7
1 changed files with 7 additions and 9 deletions

View File

@ -313,7 +313,7 @@ public class TestSplitTransactionOnCluster {
// Get region pre-split.
HRegionServer server = cluster.getRegionServer(tableRegionIndex);
printOutRegions(server, "Initial regions: ");
int regionCount = ProtobufUtil.getOnlineRegions(server.getRSRpcServices()).size();
int regionCount = cluster.getRegions(hri.getTable()).size();
regionStates.updateRegionState(hri, RegionState.State.CLOSING);
// Now try splitting.... should fail. And each should successfully
@ -324,8 +324,7 @@ public class TestSplitTransactionOnCluster {
// Wait around a while and assert count of regions remains constant.
for (int i = 0; i < 10; i++) {
Thread.sleep(100);
assertEquals(regionCount, ProtobufUtil.getOnlineRegions(
server.getRSRpcServices()).size());
assertEquals(regionCount, cluster.getRegions(hri.getTable()).size());
}
regionStates.updateRegionState(hri, State.OPEN);
// Now try splitting and it should work.
@ -367,13 +366,13 @@ public class TestSplitTransactionOnCluster {
// Get region pre-split.
HRegionServer server = cluster.getRegionServer(tableRegionIndex);
printOutRegions(server, "Initial regions: ");
int regionCount = ProtobufUtil.getOnlineRegions(server.getRSRpcServices()).size();
int regionCount = cluster.getRegions(hri.getTable()).size();
// Now split.
split(hri, server, regionCount);
// Get daughters
List<HRegion> daughters = checkAndGetDaughters(tableName);
// Now split one of the daughters.
regionCount = ProtobufUtil.getOnlineRegions(server.getRSRpcServices()).size();
regionCount = cluster.getRegions(hri.getTable()).size();
RegionInfo daughter = daughters.get(0).getRegionInfo();
LOG.info("Daughter we are going to split: " + daughter);
// Compact first to ensure we have cleaned up references -- else the split
@ -809,14 +808,13 @@ public class TestSplitTransactionOnCluster {
private void split(final RegionInfo hri, final HRegionServer server, final int regionCount)
throws IOException, InterruptedException {
this.admin.splitRegion(hri.getRegionName());
for (int i = 0; this.cluster.getRegions(hri.getTable()).size() <= regionCount && i < 60; i++) {
admin.splitRegion(hri.getRegionName());
for (int i = 0; cluster.getRegions(hri.getTable()).size() <= regionCount && i < 60; i++) {
LOG.debug("Waiting on region " + hri.getRegionNameAsString() + " to split");
Thread.sleep(2000);
}
assertFalse("Waited too long for split",
this.cluster.getRegions(hri.getTable()).size() <= regionCount);
cluster.getRegions(hri.getTable()).size() <= regionCount);
}
/**