HBASE-21097 Flush pressure assertion may fail in testFlushThroughputTuning

Amending-Author: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Ted Yu 2018-09-15 18:19:36 +08:00 committed by zhangduo
parent 38a697ad1e
commit 9da20a4116
1 changed files with 7 additions and 1 deletions

View File

@ -177,12 +177,18 @@ public class TestFlushWithThroughputController {
.build()); .build());
hbtu.waitTableAvailable(tableName); hbtu.waitTableAvailable(tableName);
HRegionServer regionServer = hbtu.getRSForFirstRegionInTable(tableName); HRegionServer regionServer = hbtu.getRSForFirstRegionInTable(tableName);
double pressure = regionServer.getFlushPressure();
LOG.debug("Flush pressure before flushing: " + pressure);
PressureAwareFlushThroughputController throughputController = PressureAwareFlushThroughputController throughputController =
(PressureAwareFlushThroughputController) regionServer.getFlushThroughputController(); (PressureAwareFlushThroughputController) regionServer.getFlushThroughputController();
for (HRegion region : regionServer.getRegions()) { for (HRegion region : regionServer.getRegions()) {
region.flush(true); region.flush(true);
} }
assertEquals(0.0, regionServer.getFlushPressure(), EPSILON); // We used to assert that the flush pressure is zero but after HBASE-15787 or HBASE-18294 we
// changed to use heapSize instead of dataSize to calculate the flush pressure, and since
// heapSize will never be zero, so flush pressure will never be zero either. So we changed the
// assertion here.
assertTrue(regionServer.getFlushPressure() < pressure);
Thread.sleep(5000); Thread.sleep(5000);
boolean tablesOnMaster = LoadBalancer.isTablesOnMaster(hbtu.getConfiguration()); boolean tablesOnMaster = LoadBalancer.isTablesOnMaster(hbtu.getConfiguration());
if (tablesOnMaster) { if (tablesOnMaster) {