From e765e19279c8f4a5a75ce7e57d75d4d7255215c0 Mon Sep 17 00:00:00 2001 From: Duo Zhang Date: Mon, 26 Apr 2021 12:03:40 +0800 Subject: [PATCH] HBASE-25806 Backport the region location finder initialization fix in HBASE-25802 (#3196) Signed-off-by: Yulin Niu --- .../hadoop/hbase/master/balancer/BaseLoadBalancer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 d925a790fe63..b99c2d3ea603 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 @@ -103,8 +103,7 @@ public String getRack(ServerName server) { * The constructor that uses the basic MetricsBalancer */ protected BaseLoadBalancer() { - metricsBalancer = new MetricsBalancer(); - createRegionFinder(); + this(null); } /** @@ -1060,7 +1059,9 @@ public void setConf(Configuration conf) { this.onlySystemTablesOnMaster = LoadBalancer.isSystemTablesOnlyOnMaster(this.config); this.rackManager = new RackManager(getConf()); + useRegionFinder = config.getBoolean("hbase.master.balancer.uselocality", true); if (useRegionFinder) { + regionFinder = new RegionLocationFinder(); regionFinder.setConf(conf); } this.isByTable = conf.getBoolean(HConstants.HBASE_MASTER_LOADBALANCE_BYTABLE, isByTable);