hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-14291 NPE On StochasticLoadBalancer Balance Involving RS With No Regions
Date Sat, 22 Aug 2015 21:52:44 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 216dbbc2f -> dab6fe298


HBASE-14291 NPE On StochasticLoadBalancer Balance Involving RS With No Regions


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/dab6fe29
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/dab6fe29
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/dab6fe29

Branch: refs/heads/0.98
Commit: dab6fe298bddd3353f1e6ede6af8d2a0f547d01c
Parents: 216dbbc
Author: tedyu <yuzhihong@gmail.com>
Authored: Sat Aug 22 14:52:37 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sat Aug 22 14:52:37 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/master/balancer/BaseLoadBalancer.java       | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/dab6fe29/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
----------------------------------------------------------------------
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 0d10531..4a6809c 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
@@ -403,7 +403,13 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
         int leastLoadedServerIndex = -1;
         int load = Integer.MAX_VALUE;
         for (ServerName sn : topLocalServers) {
-          int index = serversToIndex.get(sn);
+          if (!serversToIndex.containsKey(sn.getHostAndPort())) {
+            continue;
+          }
+          int index = serversToIndex.get(sn.getHostAndPort());
+          if (regionsPerServer[index] == null) {
+            continue;
+          }
           int tempLoad = regionsPerServer[index].length;
           if (tempLoad <= load) {
             leastLoadedServerIndex = index;


Mime
View raw message