hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhang...@apache.org
Subject [23/51] [abbrv] hbase git commit: HBASE-19672 Correct comments for default values of major compaction in SortedCompactionPolicy#getNextMajorCompactTime()
Date Tue, 02 Jan 2018 02:01:17 GMT
HBASE-19672 Correct comments for default values of major compaction in SortedCompactionPolicy#getNextMajorCompactTime()

Signed-off-by: tedyu <yuzhihong@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0cd6050d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0cd6050d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0cd6050d

Branch: refs/heads/HBASE-19397
Commit: 0cd6050d090d11240a40c012716b3d747fbcb58f
Parents: 0d0964a
Author: Xiang Li <waterlx@gmail.com>
Authored: Sat Dec 30 15:27:20 2017 +0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sat Dec 30 16:27:20 2017 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/HConstants.java  | 13 ++++++++++++-
 .../compactions/CompactionConfiguration.java           |  7 ++++---
 .../compactions/SortedCompactionPolicy.java            |  9 +++++++--
 3 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0cd6050d/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
index d09f722..1cd6f89 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java
@@ -266,8 +266,19 @@ public final class HConstants {
   /** Parameter name for how often we should try to write a version file, before failing
*/
   public static final int DEFAULT_VERSION_FILE_WRITE_ATTEMPTS = 3;
 
-  /** Parameter name for how often a region should should perform a major compaction */
+  /** Parameter name and default value for how often a region should perform a major compaction
*/
   public static final String MAJOR_COMPACTION_PERIOD = "hbase.hregion.majorcompaction";
+  public static final long   DEFAULT_MAJOR_COMPACTION_PERIOD = 1000 * 60 * 60 * 24 * 7; //
7 days
+
+  /**
+   * Parameter name and default value for major compaction jitter.
+   * Used as a multiplier applied to {@link HConstants#MAJOR_COMPACTION_PERIOD}
+   * to cause compaction to occur a given amount of time either side of
+   * {@link HConstants#MAJOR_COMPACTION_PERIOD}.
+   * Default to 0.5 so jitter has us fall evenly either side of when the compaction should
run.
+   */
+  public static final String MAJOR_COMPACTION_JITTER = "hbase.hregion.majorcompaction.jitter";
+  public static final float  DEFAULT_MAJOR_COMPACTION_JITTER = 0.50F;
 
   /** Parameter name for the maximum batch of KVs to be used in flushes and compactions */
   public static final String COMPACTION_KV_MAX = "hbase.hstore.compaction.kv.max";

http://git-wip-us.apache.org/repos/asf/hbase/blob/0cd6050d/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionConfiguration.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionConfiguration.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionConfiguration.java
index d2a86c1..212eb04 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionConfiguration.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionConfiguration.java
@@ -127,9 +127,10 @@ public class CompactionConfiguration {
 
     throttlePoint = conf.getLong("hbase.regionserver.thread.compaction.throttle",
           2 * maxFilesToCompact * storeConfigInfo.getMemStoreFlushSize());
-    majorCompactionPeriod = conf.getLong(HConstants.MAJOR_COMPACTION_PERIOD, 1000*60*60*24*7);
-    // Make it 0.5 so jitter has us fall evenly either side of when the compaction should
run
-    majorCompactionJitter = conf.getFloat("hbase.hregion.majorcompaction.jitter", 0.50F);
+    majorCompactionPeriod = conf.getLong(HConstants.MAJOR_COMPACTION_PERIOD,
+                                         HConstants.DEFAULT_MAJOR_COMPACTION_PERIOD);
+    majorCompactionJitter = conf.getFloat(HConstants.MAJOR_COMPACTION_JITTER,
+                                          HConstants.DEFAULT_MAJOR_COMPACTION_JITTER);
     minLocalityToForceCompact = conf.getFloat(HBASE_HSTORE_MIN_LOCALITY_TO_SKIP_MAJOR_COMPACT,
0f);
 
     dateTieredMaxStoreFileAgeMillis = conf.getLong(DATE_TIERED_MAX_AGE_MILLIS_KEY, Long.MAX_VALUE);

http://git-wip-us.apache.org/repos/asf/hbase/blob/0cd6050d/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/SortedCompactionPolicy.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/SortedCompactionPolicy.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/SortedCompactionPolicy.java
index f0436f9..4f6aba9 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/SortedCompactionPolicy.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/SortedCompactionPolicy.java
@@ -119,16 +119,21 @@ public abstract class SortedCompactionPolicy extends CompactionPolicy
{
    * @return When to run next major compaction
    */
   public long getNextMajorCompactTime(Collection<HStoreFile> filesToCompact) {
-    // default = 24hrs
+    /** Default to {@link org.apache.hadoop.hbase.HConstants#DEFAULT_MAJOR_COMPACTION_PERIOD}.
*/
     long period = comConf.getMajorCompactionPeriod();
     if (period <= 0) {
       return period;
     }
-    // default = 20% = +/- 4.8 hrs
+
+    /**
+     * Default to {@link org.apache.hadoop.hbase.HConstants#DEFAULT_MAJOR_COMPACTION_JITTER},
+     * that is, +/- 3.5 days (7 days * 0.5).
+     */
     double jitterPct = comConf.getMajorCompactionJitter();
     if (jitterPct <= 0) {
       return period;
     }
+
     // deterministic jitter avoids a major compaction storm on restart
     OptionalInt seed = StoreUtils.getDeterministicRandomSeed(filesToCompact);
     if (seed.isPresent()) {


Mime
View raw message