HBASE-3969 Outdated data can not be cleaned in time
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1138730 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1df7e7ac77
commit
a8f9f4d751
|
@ -361,6 +361,7 @@ Release 0.90.4 - Unreleased
|
|||
HBASE-3919 More places output binary data to text (Dave Latham)
|
||||
HBASE-3873 HBase IRB shell: Don't pretty-print the output when stdout
|
||||
isn't a TTY (Benoît Sigoure)
|
||||
HBASE-3969 Outdated data can not be cleaned in time (Zhou Shuaifeng)
|
||||
|
||||
Release 0.90.3 - May 19th, 2011
|
||||
|
||||
|
|
|
@ -1050,12 +1050,21 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||
*/
|
||||
private static class CompactionChecker extends Chore {
|
||||
private final HRegionServer instance;
|
||||
private final int majorCompactPriority;
|
||||
private final static int DEFAULT_PRIORITY = Integer.MAX_VALUE;
|
||||
|
||||
CompactionChecker(final HRegionServer h, final int sleepTime,
|
||||
final Stoppable stopper) {
|
||||
super("CompactionChecker", sleepTime, h);
|
||||
this.instance = h;
|
||||
LOG.info("Runs every " + StringUtils.formatTime(sleepTime));
|
||||
|
||||
/* MajorCompactPriority is configurable.
|
||||
* If not set, the compaction will use default priority.
|
||||
*/
|
||||
this.majorCompactPriority = this.instance.conf.
|
||||
getInt("hbase.regionserver.compactionChecker.majorCompactPriority",
|
||||
DEFAULT_PRIORITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1065,10 +1074,20 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||
continue;
|
||||
for (Store s : r.getStores().values()) {
|
||||
try {
|
||||
if (s.isMajorCompaction() || s.needsCompaction()) {
|
||||
if (s.needsCompaction()) {
|
||||
// Queue a compaction. Will recognize if major is needed.
|
||||
this.instance.compactSplitThread.requestCompaction(r, s,
|
||||
getName() + " requests major compaction");
|
||||
getName() + " requests compaction");
|
||||
} else if (s.isMajorCompaction()) {
|
||||
if (majorCompactPriority == DEFAULT_PRIORITY ||
|
||||
majorCompactPriority > r.getCompactPriority()) {
|
||||
this.instance.compactSplitThread.requestCompaction(r, s,
|
||||
getName() + " requests major compaction; use default priority");
|
||||
} else {
|
||||
this.instance.compactSplitThread.requestCompaction(r, s,
|
||||
getName() + " requests major compaction; use configured priority",
|
||||
this.majorCompactPriority);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Failed major compaction check on " + r, e);
|
||||
|
|
Loading…
Reference in New Issue