diff --git a/hdfs/CHANGES.txt b/hdfs/CHANGES.txt index a2613489dc6..d2ece0c5089 100644 --- a/hdfs/CHANGES.txt +++ b/hdfs/CHANGES.txt @@ -746,6 +746,9 @@ Trunk (unreleased changes) HDFS-1942. Datanode must exist when all the block pool service threads exit. (Bharath Mundlapudi via suresh) + HDFS-1656. Fixes an issue to do with fetching of delegation tokens in + HftpFileSystem. Contributed by Kan Zhang. + Release 0.22.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/hdfs/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java b/hdfs/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java index bcc7426f78b..684d8e8a39e 100644 --- a/hdfs/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java +++ b/hdfs/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java @@ -190,9 +190,6 @@ public class HftpFileSystem extends FileSystem { } } - //Renew TGT if needed - ugi.reloginFromKeytab(); - //since we don't already have a token, go get one over https if (delegationToken == null) { delegationToken = @@ -204,8 +201,10 @@ public class HftpFileSystem extends FileSystem { @Override - public Token getDelegationToken(final String renewer) throws IOException { + public synchronized Token getDelegationToken(final String renewer) throws IOException { try { + //Renew TGT if needed + ugi.reloginFromKeytab(); return ugi.doAs(new PrivilegedExceptionAction>() { public Token run() throws IOException { Credentials c;