HBASE-9310 Remove slop for Stochastic load balancer

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1517002 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
eclark 2013-08-23 19:44:12 +00:00
parent f3580da357
commit ecafc4a678
2 changed files with 13 additions and 2 deletions

View File

@ -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;

View File

@ -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);