From 048ac6a4a3fb88aa52b53355efba0fd007f5f119 Mon Sep 17 00:00:00 2001 From: Vinod Kumar Vavilapalli Date: Tue, 10 Jan 2012 01:39:47 +0000 Subject: [PATCH] MAPREDUCE-3639. Fixed TokenCache to work with absent FileSystem canonical service-names. (Siddharth Seth via vinodkv) svn merge --ignore-ancestry -c 1229444 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1229446 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../org/apache/hadoop/mapreduce/security/TokenCache.java | 6 +++++- .../apache/hadoop/mapreduce/security/TestTokenCache.java | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 7f16f6d4b97..68e3cf3722d 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -384,6 +384,9 @@ Release 0.23.1 - Unreleased MAPREDUCE-3616. Thread pool for launching containers in MR AM not expanding as expected. (vinodkv via sseth) + MAPREDUCE-3639. Fixed TokenCache to work with absent FileSystem canonical + service-names. (Siddharth Seth via vinodkv) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/TokenCache.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/TokenCache.java index c3a084d2392..9b60c33f9ae 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/TokenCache.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/TokenCache.java @@ -172,10 +172,14 @@ public class TokenCache { @InterfaceAudience.Private public static Token getDelegationToken( Credentials credentials, String namenode) { + //No fs specific tokens issues by this fs. It may however issue tokens + // for other filesystems - which would be keyed by that filesystems name. + if (namenode == null) + return null; return (Token) credentials.getToken(new Text( namenode)); } - + /** * load job token from a file * @param conf diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java index 5d2101b2292..8c084fe0ba6 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/security/TestTokenCache.java @@ -130,7 +130,7 @@ public class TestTokenCache { private FileSystem setupMultiFs(final FileSystem singleFs, final String renewer, final Credentials credentials) throws Exception { FileSystem mockFs = mock(FileSystem.class); - when(mockFs.getCanonicalServiceName()).thenReturn("multifs"); + when(mockFs.getCanonicalServiceName()).thenReturn(null); when(mockFs.getUri()).thenReturn(new URI("multifs:///")); when(mockFs.getDelegationTokens(any(String.class))).thenThrow(