Index: src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (revision 1483435) +++ src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (working copy) @@ -1415,7 +1415,7 @@ *
This method may block for some time, so it should not be called from a * time-sensitive thread. * - * @return true if cache was flushed + * @return true if the region needs compaction * * @throws IOException general io exceptions * @throws DroppedSnapshotException Thrown when replay of hlog is required Index: src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 1483435) +++ src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (working copy) @@ -2449,7 +2449,10 @@ throw new IllegalArgumentException("No region : " + new String(regionName) + " available"); } - region.flushcache(); + boolean needsCompaction = region.flushcache(); + if (needsCompaction) { + this.compactSplitThread.requestCompaction(region, "Compaction through user triggered flush"); + } } /** @@ -2462,7 +2465,13 @@ throw new IllegalArgumentException("No region : " + new String(regionName) + " available"); } - if (region.getLastFlushTime() < ifOlderThanTS) region.flushcache(); + if (region.getLastFlushTime() < ifOlderThanTS) { + boolean needsCompaction = region.flushcache(); + if (needsCompaction) { + this.compactSplitThread + .requestCompaction(region, "Compaction through user triggered flush"); + } + } } /** @@ -3247,7 +3256,10 @@ checkOpen(); LOG.info("Flushing " + regionInfo.getRegionNameAsString()); HRegion region = getRegion(regionInfo.getRegionName()); - region.flushcache(); + boolean needsCompaction = region.flushcache(); + if (needsCompaction) { + this.compactSplitThread.requestCompaction(region, "Compaction through user triggered flush"); + } } @Override