You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jd...@apache.org on 2010/04/08 20:19:25 UTC

svn commit: r932046 - in /hadoop/hbase/branches/0.20_pre_durability: CHANGES.txt src/java/org/apache/hadoop/hbase/client/HConnectionManager.java

Author: jdcryans
Date: Thu Apr  8 18:19:25 2010
New Revision: 932046

URL: http://svn.apache.org/viewvc?rev=932046&view=rev
Log:
HBASE-2417  HCM.locateRootRegion fails hard on "Connection refused"

Modified:
    hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt
    hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java

Modified: hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt?rev=932046&r1=932045&r2=932046&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt Thu Apr  8 18:19:25 2010
@@ -36,6 +36,7 @@ Release 0.20.4 - Unreleased
                empty and won't load region (Cosmin Lehene via Stack)
    HBASE-2365  Double-assignment around split
    HBASE-2335  mapred package docs don't say zookeeper jar is a dependent
+   HBASE-2417  HCM.locateRootRegion fails hard on "Connection refused"
 
   IMPROVEMENTS
    HBASE-2180  Bad read performance from synchronizing hfile.fddatainputstream

Modified: hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=932046&r1=932045&r2=932046&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java Thu Apr  8 18:19:25 2010
@@ -1004,14 +1004,12 @@ public class HConnectionManager implemen
             LOG.debug("Found ROOT at " + rootRegionAddress);
           }
           break;
-        } catch (IOException e) {
+        } catch (Throwable t) {
+          t = translateException(t);
+
           if (tries == numRetries - 1) {
-            // Don't bother sleeping. We've run out of retries.
-            if (e instanceof RemoteException) {
-              e = RemoteExceptionHandler.decodeRemoteException(
-                  (RemoteException) e);
-            }
-            throw e;
+            throw new NoServerForRegionException("Timed out trying to locate "+
+                "root region because: " + t.getMessage());
           }
           
           // Sleep and retry finding root region.
@@ -1051,15 +1049,7 @@ public class HConnectionManager implemen
           callable.instantiateServer(tries != 0);
           return callable.call();
         } catch (Throwable t) {
-          if (t instanceof UndeclaredThrowableException) {
-            t = t.getCause();
-          }
-          if (t instanceof RemoteException) {
-            t = RemoteExceptionHandler.decodeRemoteException((RemoteException)t);
-          }
-          if (t instanceof DoNotRetryIOException) {
-            throw (DoNotRetryIOException)t;
-          }
+          t = translateException(t);
           exceptions.add(t);
           if (tries == numRetries - 1) {
             throw new RetriesExhaustedException(callable.getServerName(),
@@ -1081,15 +1071,7 @@ public class HConnectionManager implemen
         callable.instantiateServer(false);
         return callable.call();
       } catch (Throwable t) {
-        if (t instanceof UndeclaredThrowableException) {
-          t = t.getCause();
-        }
-        if (t instanceof RemoteException) {
-          t = RemoteExceptionHandler.decodeRemoteException((RemoteException) t);
-        }
-        if (t instanceof DoNotRetryIOException) {
-          throw (DoNotRetryIOException) t;
-        }
+        t = translateException(t);
       }
       return null;
     }
@@ -1307,3 +1289,16 @@ public class HConnectionManager implemen
     }
   } 
 }
+
+    private Throwable translateException(Throwable t) throws IOException {
+      if (t instanceof UndeclaredThrowableException) {
+        t = t.getCause();
+      }
+      if (t instanceof RemoteException) {
+        t = RemoteExceptionHandler.decodeRemoteException((RemoteException)t);
+      }
+      if (t instanceof DoNotRetryIOException) {
+        throw (DoNotRetryIOException)t;
+      }
+      return t;
+    }