hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mbau...@apache.org
Subject svn commit: r1384673 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
Date Fri, 14 Sep 2012 07:52:48 GMT
Author: mbautin
Date: Fri Sep 14 07:52:47 2012
New Revision: 1384673

URL: http://svn.apache.org/viewvc?rev=1384673&view=rev
Log:
[master] [89-fb] Fix NPE in setOpen

Author: mbautin

Summary: Noticed this in TestRegionStateOnMasterFailure. rHBASEEIGHTNINEFBBRANCH1382294 introduced
the line where the NPE happens. Apparently setOpen can sometimes be called when the server
name is still null (that should still be investigated).

Test Plan: Run unit tests

Reviewers: aaiyer

Reviewed By: aaiyer

Differential Revision: https://reviews.facebook.net/D5397

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

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java?rev=1384673&r1=1384672&r2=1384673&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
Fri Sep 14 07:52:47 2012
@@ -64,6 +64,8 @@ import org.apache.hadoop.hbase.zookeeper
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper;
 import org.apache.hadoop.io.Text;
 
+import com.google.common.base.Preconditions;
+
 /**
  * Class to manage assigning regions to servers, state of root and meta, etc.
  */
@@ -1451,12 +1453,15 @@ public class RegionManager {
    * @param regionName
    */
   public void setOpen(String regionName) {
+    Preconditions.checkNotNull(regionName);
     synchronized (regionsInTransition) {
       RegionState s = regionsInTransition.get(regionName);
       if (s != null) {
         s.setOpen();
         this.master.getMetrics().incRegionsOpened();
-        this.regionLocationHintToDetectDupAssignment.put(regionName, s.serverName);
+        if (s.serverName != null) {
+          this.regionLocationHintToDetectDupAssignment.put(regionName, s.serverName);
+        }
       }
     }
 



Mime
View raw message