Kaynağa Gözat

HDFS-1656. Fixes an issue to do with fetching of delegation tokens in HftpFileSystem. Contributed by Kan Zhang.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1136608 13f79535-47bb-0310-9956-ffa450edef68
Matthew Foley 14 yıl önce
ebeveyn
işleme
01a407d9df

+ 3 - 0
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

+ 3 - 4
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<Token<?>>() {
         public Token<?> run() throws IOException {
           Credentials c;