HADOOP-17068. Client fails forever when namenode ipaddr changed. Contributed by Sean Chow.

This commit is contained in:
He Xiaoqiao 2020-06-23 16:13:43 +08:00
parent 7c02d1889b
commit fa14e4bc00
1 changed files with 11 additions and 2 deletions

View File

@ -649,6 +649,7 @@ private synchronized boolean updateAddress() throws IOException {
private synchronized void setupConnection(
UserGroupInformation ticket) throws IOException {
LOG.debug("Setup connection to " + server.toString());
short ioFailures = 0;
short timeoutFailures = 0;
while (true) {
@ -711,8 +712,16 @@ private synchronized void setupConnection(
} catch (IOException ie) {
if (updateAddress()) {
timeoutFailures = ioFailures = 0;
try {
// HADOOP-17068: when server changed, ignore the exception.
handleConnectionFailure(ioFailures++, ie);
} catch (IOException ioe) {
LOG.warn("Exception when handle ConnectionFailure: "
+ ioe.getMessage());
}
} else {
handleConnectionFailure(ioFailures++, ie);
}
handleConnectionFailure(ioFailures++, ie);
}
}
}
@ -1277,7 +1286,7 @@ private synchronized void close() {
cleanupCalls();
}
} else {
// log the info
// Log the newest server information if update address.
if (LOG.isDebugEnabled()) {
LOG.debug("closing ipc connection to " + server + ": " +
closeException.getMessage(),closeException);