hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1148175 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
Date Tue, 19 Jul 2011 05:23:26 GMT
Author: tedyu
Date: Tue Jul 19 05:23:25 2011
New Revision: 1148175

URL: http://svn.apache.org/viewvc?rev=1148175&view=rev
Log:
HBASE-4093 When verifyAndAssignRoot throws exception, the deadServers state cannot be changed

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1148175&r1=1148174&r2=1148175&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Tue Jul 19 05:23:25 2011
@@ -73,6 +73,8 @@ Release 0.90.4 - Unreleased
    HBASE-4112  Creating table may throw NullPointerException (Jinchao via Ted Yu)
    HBASE-4095  Hlog may not be rolled in a long time if checkLowReplication's request
                of LogRoll is blocked (Jieshan via Ted Yu)
+   HBASE-4093  When verifyAndAssignRoot throws exception, the deadServers state cannot
+               be changed (fulin wang via Ted Yu)
 
   IMPROVEMENT
    HBASE-3882  hbase-config.sh needs to be updated so it can auto-detects the

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java?rev=1148175&r1=1148174&r2=1148175&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
Tue Jul 19 05:23:25 2011
@@ -94,6 +94,43 @@ public class ServerShutdownHandler exten
   }
   
   /**
+   * Failed many times, shutdown processing
+   * @throws IOException
+   */
+  private void verifyAndAssignRootWithRetries() throws IOException {
+    int iTimes = this.server.getConfiguration().getInt(
+        "hbase.catalog.verification.retries", 10);
+
+    long waitTime = this.server.getConfiguration().getLong(
+        "hbase.catalog.verification.timeout", 1000);
+
+    int iFlag = 0;
+    while (true) {
+      try {
+        verifyAndAssignRoot();
+        break;
+      } catch (KeeperException e) {
+        this.server.abort("In server shutdown processing, assigning root", e);
+        throw new IOException("Aborting", e);
+      } catch (Exception e) {
+        if (iFlag >= iTimes) {
+          this.server.abort("verifyAndAssignRoot failed after" + iTimes
+              + " times retries, aborting", e);
+          throw new IOException("Aborting", e);
+        }
+        try {
+          Thread.sleep(waitTime);
+        } catch (InterruptedException e1) {
+          LOG.warn("Interrupted when is the thread sleep", e1);
+          Thread.currentThread().interrupt();
+          throw new IOException("Interrupted", e1);
+        }
+        iFlag++;
+      }
+    }
+  }
+  
+  /**
    * @return True if the server we are processing was carrying <code>-ROOT-</code>
    */
   boolean isCarryingRoot() {
@@ -123,16 +160,7 @@ public class ServerShutdownHandler exten
 
     // Assign root and meta if we were carrying them.
     if (isCarryingRoot()) { // -ROOT-
-      try {
-        verifyAndAssignRoot();
-      } catch (KeeperException e) {
-        this.server.abort("In server shutdown processing, assigning root", e);
-        throw new IOException("Aborting", e);
-      } catch (InterruptedException e1) {
-        LOG.warn("Interrupted while verifying root region's location", e1);
-        Thread.currentThread().interrupt();
-        throw new IOException(e1);  
-      }
+      verifyAndAssignRootWithRetries();
     }
 
     // Carrying meta?



Mime
View raw message