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:20:19 UTC

svn commit: r932048 - in /hadoop/hbase/trunk: CHANGES.txt core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java

Author: jdcryans
Date: Thu Apr  8 18:20:18 2010
New Revision: 932048

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

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=932048&r1=932047&r2=932048&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Thu Apr  8 18:20:18 2010
@@ -265,6 +265,7 @@ Release 0.21.0 - Unreleased
                (Kannan Muthukkaruppan via Stack)
    HBASE-2410  spurious warnings from util.Sleeper
    HBASE-2335  mapred package docs don't say zookeeper jar is a dependent
+   HBASE-2417  HCM.locateRootRegion fails hard on "Connection refused"
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=932048&r1=932047&r2=932048&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Thu Apr  8 18:20:18 2010
@@ -1015,14 +1015,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.
@@ -1063,15 +1061,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(),
@@ -1093,15 +1083,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;
     }
@@ -1438,5 +1420,18 @@ 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;
+    }
   }
 }