You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2011/12/19 18:24:21 UTC

svn commit: r1220863 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java

Author: tedyu
Date: Mon Dec 19 17:24:21 2011
New Revision: 1220863

URL: http://svn.apache.org/viewvc?rev=1220863&view=rev
Log:
HBASE-5060  HBase client is blocked forever (Jinchao)

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1220863&r1=1220862&r2=1220863&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Mon Dec 19 17:24:21 2011
@@ -837,6 +837,7 @@ Release 0.90.6 - Unreleased
 
   BUG FIXES
    HBASE-4970  Add a parameter so that keepAliveTime of Htable thread pool can be changed (gaojinchao)
+   HBASE-5060  HBase client is blocked forever (Jinchao)
 
 Release 0.90.5 - Unreleased
 

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java?rev=1220863&r1=1220862&r2=1220863&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java Mon Dec 19 17:24:21 2011
@@ -105,6 +105,7 @@ public class CatalogTracker {
   private final MetaNodeTracker metaNodeTracker;
   private final AtomicBoolean metaAvailable = new AtomicBoolean(false);
   private boolean instantiatedzkw = false;
+  private Abortable abortable;
 
   /*
    * Do not clear this address once set.  Its needed when we do
@@ -184,8 +185,21 @@ public class CatalogTracker {
     this.connection = connection;
     if (abortable == null) {
       // A connection is abortable.
-      abortable = this.connection;
+      this.abortable = this.connection;
     }
+    Abortable throwableAborter = new Abortable() {
+
+      @Override
+      public void abort(String why, Throwable e) {
+        throw new RuntimeException(why, e);
+      }
+
+      @Override
+      public boolean isAborted() {
+        return true;
+      }
+
+    };
     if (zk == null) {
       // Create our own.  Set flag so we tear it down on stop.
       this.zookeeper =
@@ -195,10 +209,10 @@ public class CatalogTracker {
     } else {
       this.zookeeper = zk;
     }
-    this.rootRegionTracker = new RootRegionTracker(zookeeper, abortable);
+    this.rootRegionTracker = new RootRegionTracker(zookeeper, throwableAborter);
     final CatalogTracker ct = this;
     // Override nodeDeleted so we get notified when meta node deleted
-    this.metaNodeTracker = new MetaNodeTracker(zookeeper, abortable) {
+    this.metaNodeTracker = new MetaNodeTracker(zookeeper, throwableAborter) {
       public void nodeDeleted(String path) {
         if (!path.equals(node)) return;
         ct.resetMetaLocation();
@@ -216,8 +230,14 @@ public class CatalogTracker {
    */
   public void start() throws IOException, InterruptedException {
     LOG.debug("Starting catalog tracker " + this);
-    this.rootRegionTracker.start();
-    this.metaNodeTracker.start();
+    try {
+      this.rootRegionTracker.start();
+      this.metaNodeTracker.start();
+    } catch (RuntimeException e) {
+      Throwable t = e.getCause();
+      this.abortable.abort(e.getMessage(), t);
+      throw new IOException("Attempt to start root/meta tracker failed.", t);
+    }
   }
 
   /**