diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 46c1f167630..54ee43a713e 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -49,6 +49,8 @@ Release 2.7.2 - UNRELEASED HADOOP-12465. Incorrect javadoc in WritableUtils.java. (Jagadesh Kiran N via aajisaka) + HADOOP-12464. Interrupted client may try to fail-over and retry (kihwal) + Release 2.7.1 - 2015-07-06 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java index 5a4e63840db..5d0274599dd 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryInvocationHandler.java @@ -103,6 +103,10 @@ public class RetryInvocationHandler implements RpcInvocationHandler { hasMadeASuccessfulCall = true; return ret; } catch (Exception e) { + if (Thread.currentThread().isInterrupted()) { + // If interrupted, do not retry. + throw e; + } boolean isIdempotentOrAtMostOnce = proxyProvider.getInterface() .getMethod(method.getName(), method.getParameterTypes()) .isAnnotationPresent(Idempotent.class); diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java index fc4855ee72f..99b0b626fa4 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java @@ -1460,22 +1460,16 @@ public class Client { throw new IOException(e); } - boolean interrupted = false; synchronized (call) { while (!call.done) { try { call.wait(); // wait for the result } catch (InterruptedException ie) { - // save the fact that we were interrupted - interrupted = true; + Thread.currentThread().interrupt(); + throw new InterruptedIOException("Call interrupted"); } } - if (interrupted) { - // set the interrupt flag now that we are done waiting - Thread.currentThread().interrupt(); - } - if (call.error != null) { if (call.error instanceof RemoteException) { call.error.fillInStackTrace();