HBASE-12697 Don't use RegionLocationFinder if localityCost == 0
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1c4da662 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1c4da662 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1c4da662 Branch: refs/heads/branch-1.0 Commit: 1c4da662788676c010d17da6e020171b78868573 Parents: 9403a1b Author: Elliott Clark <[email protected]> Authored: Mon Dec 15 19:11:54 2014 -0800 Committer: Enis Soztutar <[email protected]> Committed: Fri Jan 2 17:17:57 2015 -0800 ---------------------------------------------------------------------- .../hbase/master/balancer/StochasticLoadBalancer.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/1c4da662/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 a9afd3e..e58f855 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 @@ -229,10 +229,19 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { clusterState.remove(masterServerName); } + // On clusters with lots of HFileLinks or lots of reference files, + // instantiating the storefile infos can be quite expensive. + // Allow turning this feature off if the locality cost is not going to + // be used in any computations. + RegionLocationFinder finder = null; + if (this.localityCost != null && this.localityCost.getMultiplier() > 0) { + finder = this.regionFinder; + } + //The clusterState that is given to this method contains the state //of all the regions in the table(s) (that's true today) // Keep track of servers to iterate through them. - Cluster cluster = new Cluster(clusterState, loads, regionFinder, rackManager); + Cluster cluster = new Cluster(clusterState, loads, finder, rackManager); if (!needsBalance(cluster)) { return null; }
