hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r916823 - in /hadoop/mapreduce/trunk: CHANGES.txt src/java/org/apache/hadoop/mapreduce/security/TokenCache.java src/test/mapred/org/apache/hadoop/mapreduce/security/TestTokenCache.java
Date Fri, 26 Feb 2010 21:30:46 GMT
Author: ddas
Date: Fri Feb 26 21:30:45 2010
New Revision: 916823

URL: http://svn.apache.org/viewvc?rev=916823&view=rev
Log:
MAPREDUCE-1537. The patch makes the job client call the getDelegationToken  only when security
is enabled. Contributed by Jitendra Nath Pandey.

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/security/TokenCache.java
    hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/security/TestTokenCache.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=916823&r1=916822&r2=916823&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Fri Feb 26 21:30:45 2010
@@ -386,6 +386,9 @@
     MAPREDUCE-1537. Fixes a compilation problem in a testcase after commit
     HDFS-984. (Jitendra Nath Pandey via ddas)
 
+    MAPREDUCE-1537. The patch makes the job client call the getDelegationToken
+    only when security is enabled. (Jitendra Nath Pandey via ddas)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/security/TokenCache.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/security/TokenCache.java?rev=916823&r1=916822&r2=916823&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/security/TokenCache.java (original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/security/TokenCache.java Fri
Feb 26 21:30:45 2010
@@ -41,6 +41,7 @@
 import org.apache.hadoop.security.TokenStorage;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.security.token.TokenIdentifier;
+import org.apache.hadoop.security.UserGroupInformation;
 
 
 /**
@@ -100,9 +101,17 @@
    */
   public static void obtainTokensForNamenodes(Path [] ps, Configuration conf) 
   throws IOException {
+    if (!UserGroupInformation.isSecurityEnabled()) {
+      return;
+    }
+    obtainTokensForNamenodesInternal(ps, conf);
+  }
+    
+  static void obtainTokensForNamenodesInternal(Path [] ps, Configuration conf)
+  throws IOException {
     // get jobtracker principal id (for the renewer)
     Text jtCreds = new Text(conf.get(JobContext.JOB_JOBTRACKER_ID, ""));
-   
+    
     for(Path p: ps) {
       FileSystem fs = FileSystem.get(p.toUri(), conf);
       if(fs instanceof DistributedFileSystem) {

Modified: hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/security/TestTokenCache.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/security/TestTokenCache.java?rev=916823&r1=916822&r2=916823&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/security/TestTokenCache.java
(original)
+++ hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/security/TestTokenCache.java
Fri Feb 26 21:30:45 2010
@@ -120,8 +120,9 @@
   private static int numSlaves = 1;
   private static JobConf jConf;
   private static ObjectMapper mapper = new ObjectMapper();
+  private static Path p1;
+  private static Path p2;
   
-
   @BeforeClass
   public static void setUp() throws Exception {
     Configuration conf = new Configuration();
@@ -133,6 +134,16 @@
     
     createTokenFileJson();
     verifySecretKeysInJSONFile();
+    dfsCluster.getNamesystem().getDelegationTokenSecretManager().startThreads();
+    FileSystem fs = dfsCluster.getFileSystem();
+    
+    p1 = new Path("file1");
+    p2 = new Path("file2");
+    
+    p1 = fs.makeQualified(p1);
+    // do not qualify p2
+    TokenCache.setTokenStorage(new TokenStorage());
+    TokenCache.obtainTokensForNamenodesInternal(new Path [] {p1, p2}, jConf);
   }
 
   @AfterClass
@@ -245,14 +256,6 @@
   public void testGetTokensForNamenodes() throws IOException {
     FileSystem fs = dfsCluster.getFileSystem();
     
-    Path p1 = new Path("file1");
-    Path p2 = new Path("file2");
-    
-    p1 = fs.makeQualified(p1);
-    // do not qualify p2
-    TokenCache.setTokenStorage(new TokenStorage());
-    TokenCache.obtainTokensForNamenodes(new Path [] {p1, p2}, jConf);
-    
     // this token is keyed by hostname:port key.
     String fs_addr = TokenCache.buildDTServiceName(p1.toUri());
     Token<DelegationTokenIdentifier> nnt = TokenCache.getDelegationToken(fs_addr);



Mime
View raw message