hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [3/3] hbase git commit: HBASE-13412 ADDENDUM Region split decisions should have jitter
Date Mon, 11 May 2015 21:03:32 GMT
HBASE-13412 ADDENDUM Region split decisions should have jitter

For 0.98 only, by default do not change ConstantSizeRegionSplitPolicy
default behavior.


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

Branch: refs/heads/0.98
Commit: dfc066ee83243695b27231af2a0be5cddefa4fb1
Parents: ee72568
Author: Andrew Purtell <apurtell@apache.org>
Authored: Mon May 11 13:39:56 2015 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Mon May 11 13:43:04 2015 -0700

----------------------------------------------------------------------
 .../hbase/regionserver/ConstantSizeRegionSplitPolicy.java      | 6 ++++--
 .../hadoop/hbase/regionserver/TestRegionSplitPolicy.java       | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/dfc066ee/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ConstantSizeRegionSplitPolicy.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ConstantSizeRegionSplitPolicy.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ConstantSizeRegionSplitPolicy.java
index ae7fdae..9ef7a9f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ConstantSizeRegionSplitPolicy.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ConstantSizeRegionSplitPolicy.java
@@ -52,8 +52,10 @@ public class ConstantSizeRegionSplitPolicy extends RegionSplitPolicy {
       this.desiredMaxFileSize = conf.getLong(HConstants.HREGION_MAX_FILESIZE,
         HConstants.DEFAULT_MAX_FILE_SIZE);
     }
-    double jitter = conf.getDouble("hbase.hregion.max.filesize.jitter", 0.25D);
-    this.desiredMaxFileSize += (long)(desiredMaxFileSize * (RANDOM.nextFloat() - 0.5D) *
jitter);
+    double jitter = conf.getDouble("hbase.hregion.max.filesize.jitter", Double.NaN);
+    if (!Double.isNaN(jitter)) {
+      this.desiredMaxFileSize += (long)(desiredMaxFileSize * (RANDOM.nextFloat() - 0.5D)
* jitter);
+    }
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/dfc066ee/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionSplitPolicy.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionSplitPolicy.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionSplitPolicy.java
index 843fba8..f24b0b8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionSplitPolicy.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionSplitPolicy.java
@@ -67,6 +67,8 @@ public class TestRegionSplitPolicy {
     // Configure IncreasingToUpperBoundRegionSplitPolicy as our split policy
     conf.set(HConstants.HBASE_REGION_SPLIT_POLICY_KEY,
       IncreasingToUpperBoundRegionSplitPolicy.class.getName());
+    conf.setDouble("hbase.hregion.max.filesize.jitter", 0.25D);
+
     // Now make it so the mock region has a RegionServerService that will
     // return 'online regions'.
     RegionServerServices rss = Mockito.mock(RegionServerServices.class);
@@ -131,6 +133,7 @@ public class TestRegionSplitPolicy {
   @Test
   public void testCreateDefault() throws IOException {
     conf.setLong(HConstants.HREGION_MAX_FILESIZE, 1234L);
+    conf.setDouble("hbase.hregion.max.filesize.jitter", 0.25D);
 
     // Using a default HTD, should pick up the file size from
     // configuration.


Mime
View raw message