Author: enis
Date: Fri Apr 25 23:07:00 2014
New Revision: 1590184

URL: http://svn.apache.org/r1590184
Log:
HBASE-10957 HMaster can abort with NPE in #rebuildUserRegions (Nicolas Liochon)

Modified:
    
hbase/branches/hbase-10070/hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java
    
hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java

Modified: 
hbase/branches/hbase-10070/hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java
URL: 
http://svn.apache.org/viewvc/hbase/branches/hbase-10070/hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java?rev=1590184&r1=1590183&r2=1590184&view=diff
==============================================================================
--- 
hbase/branches/hbase-10070/hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java
 (original)
+++ 
hbase/branches/hbase-10070/hbase-client/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java
 Fri Apr 25 23:07:00 2014
@@ -717,7 +717,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;

Modified: 
hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
URL: 
http://svn.apache.org/viewvc/hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java?rev=1590184&r1=1590183&r2=1590184&view=diff
==============================================================================
--- 
hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
 (original)
+++ 
hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
 Fri Apr 25 23:07:00 2014
@@ -52,6 +52,7 @@ import org.apache.hadoop.hbase.HRegionIn
 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;
@@ -2653,7 +2654,13 @@ public class AssignmentManager extends Z
     // Iterate regions in META
     for (Result result : results) {
       HRegionInfo regionInfo;
-      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;
       // Do the operations for all the replicas
       for (HRegionLocation hrl : locations) {


Reply via email to