diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java index 3d390a5c3f4..54da5c473b3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java @@ -342,7 +342,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer { } // slop for regions - private float slop; + protected float slop; private Configuration config; private static final Random RANDOM = new Random(System.currentTimeMillis()); private static final Log LOG = LogFactory.getLog(BaseLoadBalancer.class); @@ -352,12 +352,17 @@ public abstract class BaseLoadBalancer implements LoadBalancer { @Override public void setConf(Configuration conf) { - this.slop = conf.getFloat("hbase.regions.slop", (float) 0.2); + setSlop(conf); if (slop < 0) slop = 0; else if (slop > 1) slop = 1; + this.config = conf; } + protected void setSlop(Configuration conf) { + this.slop = conf.getFloat("hbase.regions.slop", (float) 0.2); + } + @Override public Configuration getConf() { return this.config; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java index e00afbd4063..8876f7df3f2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java @@ -122,6 +122,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { @Override public void setConf(Configuration conf) { super.setConf(conf); + regionFinder.setConf(conf); maxSteps = conf.getInt(MAX_STEPS_KEY, maxSteps); @@ -159,6 +160,11 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { }; } + @Override + protected void setSlop(Configuration conf) { + this.slop = conf.getFloat("hbase.regions.slop", 0.001F); + } + @Override public void setClusterStatus(ClusterStatus st) { super.setClusterStatus(st);