hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject svn commit: r1205513 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java
Date Wed, 23 Nov 2011 18:03:11 GMT
Author: ramkrishna
Date: Wed Nov 23 18:03:10 2011
New Revision: 1205513

URL: http://svn.apache.org/viewvc?rev=1205513&view=rev
Log:
HBASE-4308 Race between RegionOpenedHandler and AssignmentManager(Ram)

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1205513&r1=1205512&r2=1205513&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Wed Nov 23 18:03:10 2011
@@ -441,6 +441,7 @@ Release 0.92.0 - Unreleased
    HBASE-4623  Remove @deprecated Scan methods in 0.90 from TRUNK and 0.92
    HBASE-4842  [hbck] Fix intermittent failures on TestHBaseFsck.testHBaseFsck
                (Jon Hsieh)
+   HBASE-4308  Race between RegionOpenedHandler and AssignmentManager (Ram)
 
   TESTS
    HBASE-4450  test for number of blocks read: to serve as baseline for expected

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java?rev=1205513&r1=1205512&r2=1205513&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java Wed Nov
23 18:03:10 2011
@@ -966,16 +966,36 @@ public class AssignmentManager extends Z
         ZKAssign.getRegionName(this.master.getZooKeeper(), path);
       RegionState rs = this.regionsInTransition.get(regionName);
       if (rs != null) {
+        HRegionInfo regionInfo = rs.getRegion();
         if (rs.isSplitting() || rs.isSplit()) {
           LOG.debug("Ephemeral node deleted, regionserver crashed?, " +
             "clearing from RIT; rs=" + rs);
           clearRegionFromTransition(rs.getRegion());
         } else {
-          LOG.warn("Node deleted but still in RIT: " + rs);
+          LOG.debug("The znode of region " + regionInfo.getRegionNameAsString()
+              + " has been deleted.");
+          if (rs.isOpened()) {
+            makeRegionOnline(rs, regionInfo);
+          }
         }
       }
     }
   }
+  
+  private void makeRegionOnline(RegionState rs, HRegionInfo regionInfo) {
+    regionOnline(regionInfo, rs.serverName);
+    LOG.info("The master has opened the region "
+        + regionInfo.getRegionNameAsString() + " that was online on "
+        + rs.serverName);
+    if (this.getZKTable().isDisablingOrDisabledTable(
+        regionInfo.getTableNameAsString())) {
+      debugLog(regionInfo, "Opened region "
+          + regionInfo.getRegionNameAsString() + " but "
+          + "this table is disabled, triggering close of region");
+      unassign(regionInfo);
+    }
+  }
+
 
   /**
    * New unassigned node has been created.

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java?rev=1205513&r1=1205512&r2=1205513&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/OpenedRegionHandler.java
Wed Nov 23 18:03:10 2011
@@ -26,7 +26,6 @@ import org.apache.hadoop.hbase.HRegionIn
 import org.apache.hadoop.hbase.Server;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.executor.EventHandler;
-import org.apache.hadoop.hbase.executor.EventHandler.EventType;
 import org.apache.hadoop.hbase.master.AssignmentManager;
 import org.apache.hadoop.hbase.master.AssignmentManager.RegionState;
 import org.apache.hadoop.hbase.zookeeper.ZKAssign;
@@ -98,28 +97,26 @@ public class OpenedRegionHandler extends
     // Code to defend against case where we get SPLIT before region open
     // processing completes; temporary till we make SPLITs go via zk -- 0.92.
     RegionState regionState = this.assignmentManager.isRegionInTransition(regionInfo);
+    boolean openedNodeDeleted = false;
     if (regionState != null
         && regionState.getState().equals(RegionState.State.OPEN)) {
-      if (deleteOpenedNode(expectedVersion)) {
-        // Remove region from in-memory transition and unassigned node from ZK
-        this.assignmentManager.regionOnline(regionInfo, this.sn);
-        debugLog(regionInfo, "The master has opened the region " +
-            regionInfo.getRegionNameAsString() + " that was online on " +
-            this.sn.toString());
-      } else {
-        LOG.error("The znode of region " + regionInfo.getRegionNameAsString() +
-          " could not be deleted.");
+      openedNodeDeleted = deleteOpenedNode(expectedVersion);
+      if (!openedNodeDeleted) {
+        LOG.error("The znode of region " + regionInfo.getRegionNameAsString()
+            + " could not be deleted.");
       }
     } else {
       LOG.warn("Skipping the onlining of " + regionInfo.getRegionNameAsString() +
         " because regions is NOT in RIT -- presuming this is because it SPLIT");
     }
-    if (this.assignmentManager.getZKTable().isDisablingOrDisabledTable(
-        regionInfo.getTableNameAsString())) {
-      debugLog(regionInfo,
-          "Opened region " + regionInfo.getRegionNameAsString() + " but "
-          + "this table is disabled, triggering close of region");
-      assignmentManager.unassign(regionInfo);
+    if (!openedNodeDeleted) {
+      if (this.assignmentManager.getZKTable().isDisablingOrDisabledTable(
+          regionInfo.getTableNameAsString())) {
+        debugLog(regionInfo, "Opened region "
+            + regionInfo.getRegionNameAsString() + " but "
+            + "this table is disabled, triggering close of region");
+        assignmentManager.unassign(regionInfo);
+      }
     }
   }
 



Mime
View raw message