hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1030255 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
Date Tue, 02 Nov 2010 22:06:48 GMT
Author: stack
Date: Tue Nov  2 22:06:47 2010
New Revision: 1030255

URL: http://svn.apache.org/viewvc?rev=1030255&view=rev
Log:
HBASE-3189 Stagger Major Compactions

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1030255&r1=1030254&r2=1030255&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Tue Nov  2 22:06:47 2010
@@ -1092,6 +1092,7 @@ Release 0.21.0 - Unreleased
                logic
    HBASE-3180  Review periodic master logging, especially ServerManager once
                a minute
+   HBASE-3189  Stagger Major Compactions (Nicolas Spiegelberg via Stack)
 
 
   NEW FEATURES

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java?rev=1030255&r1=1030254&r2=1030255&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java Tue Nov  2 22:06:47
2010
@@ -190,13 +190,7 @@ public class Store implements HeapSize {
     this.blockingStoreFileCount =
       conf.getInt("hbase.hstore.blockingStoreFiles", -1);
 
-    this.majorCompactionTime =
-      conf.getLong(HConstants.MAJOR_COMPACTION_PERIOD, 86400000);
-    if (family.getValue(HConstants.MAJOR_COMPACTION_PERIOD) != null) {
-      String strCompactionTime =
-        family.getValue(HConstants.MAJOR_COMPACTION_PERIOD);
-      this.majorCompactionTime = (new Long(strCompactionTime)).longValue();
-    }
+    this.majorCompactionTime = getNextMajorCompactTime();
 
     this.maxFilesToCompact = conf.getInt("hbase.hstore.compaction.max", 10);
     if (Store.closeCheckInterval == 0) {
@@ -789,10 +783,31 @@ public class Store implements HeapSize {
             "; time since last major compaction " + (now - lowTimestamp) + "ms");
         }
         result = true;
+        this.majorCompactionTime = getNextMajorCompactTime();
       }
     }
     return result;
   }
+  
+  long getNextMajorCompactTime() {
+    // default = 24hrs
+    long ret = conf.getLong(HConstants.MAJOR_COMPACTION_PERIOD, 1000*60*60*24);
+    if (family.getValue(HConstants.MAJOR_COMPACTION_PERIOD) != null) {
+      String strCompactionTime =
+        family.getValue(HConstants.MAJOR_COMPACTION_PERIOD);
+      ret = (new Long(strCompactionTime)).longValue();
+    }
+    
+    if (ret > 0) {
+      // default = +/- 4 hrs
+      long jitter =  conf.getLong("hbase.hregion.majorcompaction.jitter", 
+          1000*60*60*4);
+      if (jitter > 0) {
+        ret += jitter - Math.round(jitter * 2 * Math.random());
+      }
+    }
+    return ret;
+  }
 
   /**
    * Do a minor/major compaction.  Uses the scan infrastructure to make it easy.



Mime
View raw message