hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1220860 - in /hbase/branches/0.92: CHANGES.txt src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
Date Mon, 19 Dec 2011 17:23:34 GMT
Author: tedyu
Date: Mon Dec 19 17:23:34 2011
New Revision: 1220860

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

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

Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1220860&r1=1220859&r2=1220860&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Mon Dec 19 17:23:34 2011
@@ -890,6 +890,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/branches/0.92/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java?rev=1220860&r1=1220859&r2=1220860&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
(original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/catalog/CatalogTracker.java
Mon Dec 19 17:23:34 2011
@@ -104,6 +104,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
@@ -183,8 +184,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 =
@@ -194,10 +208,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();
@@ -215,8 +229,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);
+    }
   }
 
   /**



Mime
View raw message