From ae502a9d5ce3dc5c4a485c3ff364d433bdf29a10 Mon Sep 17 00:00:00 2001 From: Guanghao Zhang Date: Tue, 25 Oct 2016 11:58:41 +0530 Subject: [PATCH] HBASE-16910 Avoid NPE when starting StochasticLoadBalancer Signed-off-by: Ashish Singhi --- .../src/main/java/org/apache/hadoop/hbase/master/HMaster.java | 2 +- .../hadoop/hbase/master/balancer/StochasticLoadBalancer.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index e079b3b1f3a..ba067e7f386 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -774,8 +774,8 @@ public class HMaster extends HRegionServer implements MasterServices, Server { } //initialize load balancer - this.balancer.setClusterStatus(getClusterStatus()); this.balancer.setMasterServices(this); + this.balancer.setClusterStatus(getClusterStatus()); this.balancer.initialize(); // Check if master is shutting down because of some issue 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 d497d42291e..7d7dc8e063c 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 @@ -232,7 +232,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { updateMetricsSize(tablesCount * (functionsCount + 1)); // +1 for overall } catch (Exception e) { - LOG.error("failed to get the size of all tables, exception = " + e.getMessage()); + LOG.error("failed to get the size of all tables", e); } }