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:49:43 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 902cd172f -> e95cf8fdb


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/e95cf8fd
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e95cf8fd
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e95cf8fd

Branch: refs/heads/master
Commit: e95cf8fdb4c78458e3058198e13c6d3cbd85a0e2
Parents: 902cd17
Author: tedyu <yuzhihong@gmail.com>
Authored: Sat Aug 22 14:49:37 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sat Aug 22 14:49: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/e95cf8fd/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 84baa7f..962b241 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
@@ -860,7 +860,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