HBASE-10957 HMaster can abort with NPE in #rebuildUserRegions (Nicolas Liochon)

git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-10070@1590184 
13f79535-47bb-0310-9956-ffa450edef68


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

Branch: refs/heads/master
Commit: e86b13f75ad2f1e88dc5f225e1297c1fd3ef954a
Parents: 48ffa4d
Author: Enis Soztutar <e...@apache.org>
Authored: Fri Apr 25 23:07:00 2014 +0000
Committer: Enis Soztutar <e...@apache.org>
Committed: Fri Jun 27 16:39:40 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/catalog/MetaReader.java    | 3 ++-
 .../org/apache/hadoop/hbase/master/AssignmentManager.java   | 9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/e86b13f7/hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java
----------------------------------------------------------------------
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java
index ca5ae39..9517113 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java
@@ -718,7 +718,8 @@ public class MetaReader {
 
   /**
    * Returns an HRegionLocationList extracted from the result.
-   * @return an HRegionLocationList containing all locations for the region 
range
+   * @return an HRegionLocationList containing all locations for the region 
range or null if
+   *  we can't deserialize the result.
    */
   public static RegionLocations getRegionLocations(final Result r) {
     if (r == null) return null;

http://git-wip-us.apache.org/repos/asf/hbase/blob/e86b13f7/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
index 6c01904..f407569 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
@@ -54,6 +54,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.NotServingRegionException;
+import org.apache.hadoop.hbase.RegionLocations;
 import org.apache.hadoop.hbase.RegionTransition;
 import org.apache.hadoop.hbase.Server;
 import org.apache.hadoop.hbase.ServerName;
@@ -2760,7 +2761,13 @@ public class AssignmentManager extends ZooKeeperListener 
{
     Set<ServerName> offlineServers = new HashSet<ServerName>();
     // Iterate regions in META
     for (Result result : results) {
-      HRegionLocation[] locations = 
MetaReader.getRegionLocations(result).getRegionLocations();
+      if (result == null && LOG.isDebugEnabled()){
+        LOG.debug("null result from meta - ignoring but this is strange.");
+        continue;
+      }
+      RegionLocations rl =  MetaReader.getRegionLocations(result);
+      if (rl == null) continue;
+      HRegionLocation[] locations = rl.getRegionLocations();
       if (locations == null) continue;
       for (HRegionLocation hrl : locations) {
         HRegionInfo regionInfo = hrl.getRegionInfo();

Reply via email to