hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1407321 - in /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler: MasterCloseRegionHandler.java MasterOpenRegionHandler.java
Date Fri, 09 Nov 2012 00:01:05 GMT
Author: liyin
Date: Fri Nov  9 00:01:04 2012
New Revision: 1407321

URL: http://svn.apache.org/viewvc?rev=1407321&view=rev
Log:
[0.89-fb] [master] Fix NPE upon processRegionOpen/Close on a master transition

Author: aaiyer

Summary:
Upon master transition, the new master looks at ZK
and processes unassigned nodes.

If the new master has not yet heard from a region server, before
it processes the regionserver's region, then this may result in
a NPE because serverInfo is not found in the RegionManager.

We can generate the serverInfo from the data in ZK (all but the
    server load).

Test Plan:
run mr tests. Try to repro the scenario and ensure that there is no
npe

Reviewers: liyintang, kannan

Reviewed By: liyintang

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D618864

Task ID: 1853876

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler/MasterCloseRegionHandler.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler/MasterOpenRegionHandler.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler/MasterCloseRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler/MasterCloseRegionHandler.java?rev=1407321&r1=1407320&r2=1407321&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler/MasterCloseRegionHandler.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler/MasterCloseRegionHandler.java
Fri Nov  9 00:01:04 2012
@@ -65,6 +65,10 @@ public class MasterCloseRegionHandler ex
     ensureEventDataAvailable();
     String serverName = hbEventData.getRsName();
     HServerInfo serverInfo = serverManager.getServerInfo(serverName);
+    if (serverInfo == null) {
+      LOG.warn("Could not find serverInfo for " + serverName + " . Creating from serverName");
+      serverInfo = HServerInfo.fromServerName(serverName);
+    }
     
     // process the region close - this will cause the reopening of the 
     // region as a part of the heartbeat of some RS

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler/MasterOpenRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler/MasterOpenRegionHandler.java?rev=1407321&r1=1407320&r2=1407321&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler/MasterOpenRegionHandler.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/handler/MasterOpenRegionHandler.java
Fri Nov  9 00:01:04 2012
@@ -83,6 +83,10 @@ public class MasterOpenRegionHandler ext
     ensureEventDataAvailable();
     LOG.debug("RS " + hbEventData.getRsName() + " has opened region " + regionName);
     HServerInfo serverInfo = serverManager.getServerInfo(hbEventData.getRsName());
+    if (serverInfo == null) {
+      LOG.warn("Could not find serverInfo for " + serverName + " . Creating from serverName");
+      serverInfo = HServerInfo.fromServerName(hbEventData.getRsName());
+    }
     ArrayList<HMsg> returnMsgs = new ArrayList<HMsg>();
     serverManager.processRegionOpen(serverInfo, hbEventData.getHmsg().getRegionInfo(), returnMsgs);
     if(returnMsgs.size() > 0) {



Mime
View raw message