Repository: hbase Updated Branches: refs/heads/master 0bb18de91 -> 5a7c8dcb6
HBASE-15504 Fix Balancer in 1.3 not moving regions off overloaded regionserver Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5a7c8dcb Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5a7c8dcb Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5a7c8dcb Branch: refs/heads/master Commit: 5a7c8dcb683515f0fe6b3de6c18e78c749f3729a Parents: 0bb18de Author: Elliott Clark <[email protected]> Authored: Tue Apr 12 15:47:16 2016 -0700 Committer: Elliott Clark <[email protected]> Committed: Wed Apr 13 18:07:00 2016 -0700 ---------------------------------------------------------------------- .../master/balancer/StochasticLoadBalancer.java | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/5a7c8dcb/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java ---------------------------------------------------------------------- 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 d01f510..ab075db 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 @@ -136,7 +136,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { private RegionReplicaRackCostFunction regionReplicaRackCostFunction; private boolean isByTable = false; private TableName tableName = null; - + /** * The constructor that pass a MetricsStochasticBalancer to BaseLoadBalancer to replace its * default MetricsBalancer @@ -200,7 +200,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { regionLoadFunctions[2], regionLoadFunctions[3], }; - + curFunctionCosts= new Double[costFunctions.length]; tempFunctionCosts= new Double[costFunctions.length]; @@ -230,7 +230,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { LOG.error("failed to get the size of all tables, exception = " + e.getMessage()); } } - + /** * Update the number of metrics that are reported to JMX */ @@ -263,7 +263,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { this.tableName = tableName; return balanceCluster(clusterState); } - + /** * Given the cluster state this will try and approach an optimal balance. This * should always approach the optimal state given enough steps. @@ -371,7 +371,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { + plans.size() + " regions; Going from a computed cost of " + initCost + " to a new cost of " + currentCost); } - + return plans; } if (LOG.isDebugEnabled()) { @@ -381,7 +381,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { } return null; } - + /** * update costs to JMX */ @@ -392,7 +392,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { if (metricsBalancer instanceof MetricsStochasticBalancer) { MetricsStochasticBalancer balancer = (MetricsStochasticBalancer) metricsBalancer; // overall cost - balancer.updateStochasticCost(tableName.getNameAsString(), + balancer.updateStochasticCost(tableName.getNameAsString(), "Overall", "Overall cost", overall); // each cost function @@ -512,7 +512,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { for (int i = 0; i < costFunctions.length; i++) { CostFunction c = costFunctions[i]; this.tempFunctionCosts[i] = 0.0; - + if (c.getMultiplier() <= 0) { continue; } @@ -527,7 +527,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { break; } } - + return total; } @@ -996,7 +996,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { private static final String MOVE_COST_KEY = "hbase.master.balancer.stochastic.moveCost"; private static final String MAX_MOVES_PERCENT_KEY = "hbase.master.balancer.stochastic.maxMovePercent"; - private static final float DEFAULT_MOVE_COST = 100; + private static final float DEFAULT_MOVE_COST = 7; private static final int DEFAULT_MAX_MOVES = 600; private static final float DEFAULT_MAX_MOVE_PERCENT = 0.25f; @@ -1430,7 +1430,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { public RegionReplicaRackCostFunction(Configuration conf) { super(conf); - this.setMultiplier(conf.getFloat(REGION_REPLICA_RACK_COST_KEY, + this.setMultiplier(conf.getFloat(REGION_REPLICA_RACK_COST_KEY, DEFAULT_REGION_REPLICA_RACK_COST_KEY)); } @@ -1503,7 +1503,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { return rl.getStorefileSizeMB(); } } - + /** * A helper function to compose the attribute name from tablename and costfunction name */
