HBASE-15634 TestDateTieredCompactionPolicy#negativeForMajor is flaky (Duo Zhang and Ted Yu)

This commit is contained in:
tedyu 2016-04-26 09:23:54 -07:00
parent 4bdd47c52c
commit dce59294ff
2 changed files with 8 additions and 1 deletions

View File

@ -112,6 +112,9 @@ public class DateTieredCompactionPolicy extends SortedCompactionPolicy {
throws IOException { throws IOException {
long mcTime = getNextMajorCompactTime(filesToCompact); long mcTime = getNextMajorCompactTime(filesToCompact);
if (filesToCompact == null || mcTime == 0) { if (filesToCompact == null || mcTime == 0) {
if (LOG.isDebugEnabled()) {
LOG.debug("filesToCompact: " + filesToCompact + " mcTime: " + mcTime);
}
return false; return false;
} }
@ -119,6 +122,10 @@ public class DateTieredCompactionPolicy extends SortedCompactionPolicy {
long lowTimestamp = StoreUtils.getLowestTimestamp(filesToCompact); long lowTimestamp = StoreUtils.getLowestTimestamp(filesToCompact);
long now = EnvironmentEdgeManager.currentTime(); long now = EnvironmentEdgeManager.currentTime();
if (lowTimestamp <= 0L || lowTimestamp >= (now - mcTime)) { if (lowTimestamp <= 0L || lowTimestamp >= (now - mcTime)) {
if (LOG.isDebugEnabled()) {
LOG.debug("lowTimestamp: " + lowTimestamp + " lowTimestamp: " + lowTimestamp + " now: " +
now + " mcTime: " + mcTime);
}
return false; return false;
} }

View File

@ -50,7 +50,7 @@ public class TestDateTieredCompactionPolicy extends AbstractTestDateTieredCompac
this.conf.setFloat(CompactionConfiguration.HBASE_HSTORE_COMPACTION_RATIO_KEY, 1.2F); this.conf.setFloat(CompactionConfiguration.HBASE_HSTORE_COMPACTION_RATIO_KEY, 1.2F);
conf.setInt(HStore.BLOCKING_STOREFILES_KEY, 20); conf.setInt(HStore.BLOCKING_STOREFILES_KEY, 20);
conf.setLong(HConstants.MAJOR_COMPACTION_PERIOD, 10); conf.setLong(HConstants.MAJOR_COMPACTION_PERIOD, 5);
} }
/** /**