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
This commit is contained in:
Enis Soztutar 2014-04-25 23:07:00 +00:00
parent 48ffa4d5e6
commit e86b13f75a
2 changed files with 10 additions and 2 deletions

View File

@ -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;

View File

@ -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();