Sfoglia il codice sorgente

MAPREDUCE-3639. Fixed TokenCache to work with absent FileSystem canonical service-names. (Siddharth Seth via vinodkv)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1229444 13f79535-47bb-0310-9956-ffa450edef68
Vinod Kumar Vavilapalli 13 anni fa
parent
commit
48150cddaf

+ 3 - 0
hadoop-mapreduce-project/CHANGES.txt

@@ -439,6 +439,9 @@ Release 0.23.1 - Unreleased
     MAPREDUCE-3616. Thread pool for launching containers in MR AM not
     MAPREDUCE-3616. Thread pool for launching containers in MR AM not
     expanding as expected. (vinodkv via sseth)
     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 
 Release 0.23.0 - 2011-11-01 
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 5 - 1
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
   @InterfaceAudience.Private
   public static Token<DelegationTokenIdentifier> getDelegationToken(
   public static Token<DelegationTokenIdentifier> getDelegationToken(
       Credentials credentials, String namenode) {
       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<DelegationTokenIdentifier>) credentials.getToken(new Text(
     return (Token<DelegationTokenIdentifier>) credentials.getToken(new Text(
         namenode));
         namenode));
   }
   }
-  
+
   /**
   /**
    * load job token from a file
    * load job token from a file
    * @param conf
    * @param conf

+ 1 - 1
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,
   private FileSystem setupMultiFs(final FileSystem singleFs,
       final String renewer, final Credentials credentials) throws Exception {
       final String renewer, final Credentials credentials) throws Exception {
     FileSystem mockFs = mock(FileSystem.class);
     FileSystem mockFs = mock(FileSystem.class);
-    when(mockFs.getCanonicalServiceName()).thenReturn("multifs");
+    when(mockFs.getCanonicalServiceName()).thenReturn(null);
     when(mockFs.getUri()).thenReturn(new URI("multifs:///"));
     when(mockFs.getUri()).thenReturn(new URI("multifs:///"));
 
 
     when(mockFs.getDelegationTokens(any(String.class))).thenThrow(
     when(mockFs.getDelegationTokens(any(String.class))).thenThrow(