From 62423910a4020bea6200c44c12fe96b6e14bd59c Mon Sep 17 00:00:00 2001 From: Ayush Saxena Date: Sun, 29 Dec 2019 13:07:22 +0530 Subject: [PATCH] HDFS-14937. [SBN read] ObserverReadProxyProvider should throw InterruptException. Contributed by xuzq. --- .../server/namenode/ha/ObserverReadProxyProvider.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProvider.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProvider.java index 67c34fe0174..e3753c3a590 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProvider.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProvider.java @@ -19,6 +19,7 @@ package org.apache.hadoop.hdfs.server.namenode.ha; import java.io.Closeable; import java.io.IOException; +import java.io.InterruptedIOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; @@ -412,6 +413,13 @@ public class ObserverReadProxyProvider throw ite.getCause(); } Exception e = (Exception) ite.getCause(); + if (e instanceof InterruptedIOException || + e instanceof InterruptedException) { + // If interrupted, do not retry. + LOG.warn("Invocation returned interrupted exception on [{}];", + current.proxyInfo, e); + throw e; + } if (e instanceof RemoteException) { RemoteException re = (RemoteException) e; Exception unwrapped = re.unwrapRemoteException(