Author: stack
Date: Thu Jun 23 03:49:23 2011
New Revision: 1138730
URL: http://svn.apache.org/viewvc?rev=1138730&view=rev
Log:
HBASE-3969 Outdated data can not be cleaned in time
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Modified: hbase/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1138730&r1=1138729&r2=1138730&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Jun 23 03:49:23 2011
@@ -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
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1138730&r1=1138729&r2=1138730&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Thu Jun 23 03:49:23 2011
@@ -1050,12 +1050,21 @@ public class HRegionServer implements HR
*/
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 HR
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);