hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject svn commit: r967290 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java
Date Fri, 23 Jul 2010 22:44:21 GMT
Author: jdcryans
Date: Fri Jul 23 22:44:21 2010
New Revision: 967290

URL: http://svn.apache.org/viewvc?rev=967290&view=rev
Log:
HBASE-2866  Region permanently offlined

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=967290&r1=967289&r2=967290&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri Jul 23 22:44:21 2010
@@ -449,6 +449,7 @@ Release 0.21.0 - Unreleased
    HBASE-2859  Cleanup deprecated stuff in TestHLog (Alex Newman via Stack)
    HBASE-2858  TestReplication.queueFailover fails half the time
    HBASE-2863  HBASE-2553 removed an important edge case
+   HBASE-2866  Region permanently offlined
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java?rev=967290&r1=967289&r2=967290&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java Fri
Jul 23 22:44:21 2010
@@ -169,6 +169,7 @@ public class ZKUnassignedWatcher impleme
     String region = zNodePath.substring(
         zNodePath.indexOf(rgnInTransitNode) + rgnInTransitNode.length() + 1);
     HBaseEventType rsEvent = HBaseEventType.fromByte(data[0]);
+    LOG.debug("Got event type [ " + rsEvent + " ] for region " + region);
 
     // if the node was CLOSED then handle it
     if(rsEvent == HBaseEventType.RS2ZK_REGION_CLOSED) {

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java?rev=967290&r1=967289&r2=967290&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java Fri
Jul 23 22:44:21 2010
@@ -1133,22 +1133,36 @@ public class ZooKeeperWrapper implements
       return;
     }
     
-    if(LOG.isDebugEnabled()) {
-      // Check existing state for logging purposes.
-      Stat stat = new Stat();
-      byte[] oldData = null;
-      try {
-        oldData = readZNode(znode, stat);
-      } catch (IOException e) {
-        LOG.error("Error reading data for " + znode);
-      }
-      if(oldData == null) {
-        LOG.debug("While updating UNASSIGNED region " + regionName + " - node exists with
no data" );          
-      }
-      else {
-        LOG.debug("While updating UNASSIGNED region " + regionName + " exists, state = "
+ (HBaseEventType.fromByte(oldData[0])));
+    Stat stat = new Stat();
+    byte[] oldData = null;
+    try {
+      oldData = readZNode(znode, stat);
+    } catch (IOException e) {
+      LOG.error("Error reading data for " + znode);
+    }
+    // If there is no data in the ZNode, then update it
+    if(oldData == null) {
+      LOG.debug("While updating UNASSIGNED region " + regionName + " - node exists with no
data" );
+    }
+    // If there is data in the ZNode, do not update if it is already correct
+    else {
+      HBaseEventType curState = HBaseEventType.fromByte(oldData[0]);
+      HBaseEventType newState = HBaseEventType.fromByte(data[0]);
+      // If the znode has the right state already, do not update it. Updating
+      // the znode again and again will bump up the zk version. This may cause
+      // the region server to fail. The RS expects that the znode is never
+      // updated by anyone else while it is opening/closing a region.
+      if(curState == newState) {
+        LOG.debug("No need to update UNASSIGNED region " + regionName +
+                  " as it already exists in state = " + curState);
+        return;
       }
+
+      // If the ZNode is in another state, then update it
+      LOG.debug("UNASSIGNED region " + regionName + " is currently in state = " +
+                curState + ", updating it to " + newState);
     }
+    // Update the ZNode
     synchronized(unassignedZNodesWatched) {
       unassignedZNodesWatched.add(znode);
       try {



Mime
View raw message