HBASE-2417 HCM.locateRootRegion fails hard on "Connection refused"

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@932048 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2010-04-08 18:20:18 +00:00
parent 1b04442fbc
commit a303215a28
2 changed files with 21 additions and 25 deletions

View File

@ -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

View File

@ -1015,14 +1015,12 @@ public class HConnectionManager implements HConstants {
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 implements HConstants {
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 implements HConstants {
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 implements HConstants {
}
};
}
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;
}
}
}