From 8373c4134afef0b7fb08a63b44ef0131faacec00 Mon Sep 17 00:00:00 2001 From: Junping Du Date: Thu, 12 Dec 2013 03:04:43 +0000 Subject: [PATCH] HDFS-5637. Try to refeatchToken while local read InvalidToken occurred. (Liang Xie via junping_du) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1550335 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/hdfs/DFSInputStream.java | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index ee9b964724c..0997058f974 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -590,6 +590,9 @@ Release 2.4.0 - UNRELEASED HDFS-5023. TestSnapshotPathINodes.testAllowSnapshot is failing with jdk7 (Mit Desai via jeagles) + HDFS-5637. Try to refeatchToken while local read InvalidToken occurred. + (Liang Xie via junping_du) + OPTIMIZATIONS HDFS-5239. Allow FSNamesystem lock fairness to be configurable (daryn) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java index 25441ff2b4c..df252343758 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java @@ -65,6 +65,7 @@ import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.net.unix.DomainSocket; import org.apache.hadoop.security.AccessControlException; +import org.apache.hadoop.security.token.SecretManager.InvalidToken; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.util.IdentityHashStore; @@ -590,7 +591,8 @@ implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead, // The encryption key used is invalid. refetchEncryptionKey--; dfsClient.clearDataEncryptionKey(); - } else if (ex instanceof InvalidBlockTokenException && refetchToken > 0) { + } else if ((ex instanceof InvalidBlockTokenException || ex instanceof InvalidToken) + && refetchToken > 0) { DFSClient.LOG.info("Will fetch a new access token and retry, " + "access token was invalid when connecting to " + targetAddr + " : " + ex); @@ -976,7 +978,8 @@ implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead, // The encryption key used is invalid. refetchEncryptionKey--; dfsClient.clearDataEncryptionKey(); - } else if (e instanceof InvalidBlockTokenException && refetchToken > 0) { + } else if ((e instanceof InvalidBlockTokenException || e instanceof InvalidToken) + && refetchToken > 0) { DFSClient.LOG.info("Will get a new access token and retry, " + "access token was invalid when connecting to " + targetAddr + " : " + e);