Skip to content

Commit

Permalink
HBASE-26752 Fix flappy test TestSimpleRegionNormalizerOnCluster (#4109)
Browse files Browse the repository at this point in the history
Signed-off-by: Viraj Jasani <vjasani@apache.org>
  • Loading branch information
mnpoonia authored Feb 11, 2022
1 parent c45133a commit 36a16a0
Showing 1 changed file with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public void testRegionNormalizationMergeOnCluster() throws Exception {
dropIfExists(TABLENAME);
}

@Test
@Test(timeout = 60000)
public void testMultiTablePlans()
throws IOException, InterruptedException, CoordinatedStateException {
// create 3 tables with regions to be normalized
Expand Down Expand Up @@ -241,18 +241,13 @@ public void testMultiTablePlans()
Thread.sleep(5000); // to let region load to update
boolean checkStatus = master.normalizeRegions();
assertTrue(checkStatus);

// checking for table 0 to check if normalizer has been triggered or not
while (MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), tableNames.get(0)) > 4) {
LOG.info("Waiting for normalization merge to complete");
Thread.sleep(100);
}
while (MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), tableNames.get(2)) > 4) {
LOG.info("Waiting for normalization merge to complete");
Thread.sleep(100);
}

Thread.sleep(1000);
// this sleeps helps in getting accurate result from MetaTableAccessor.getRegionCount
Thread.sleep(5000);
// something is miss in test. If this test passes that doesnot mean correctness
// but this test failing means there is surely an issue. It happens because the order of table
// normalization is not fix so there are chances that the second table is finished in the end
// which means test will pass even though there is an issue in normalizer.
// Culprit is HMaster code where we call Collections.shuffle(allEnabledTables)
assertEquals(4, MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), tableNames.get(0)));
assertEquals(5, MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), tableNames.get(1)));
assertEquals(4, MetaTableAccessor.getRegionCount(TEST_UTIL.getConnection(), tableNames.get(2)));
Expand Down

0 comments on commit 36a16a0

Please sign in to comment.