hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1349986 - in /hadoop/common/branches/branch-1: CHANGES.txt src/mapred/org/apache/hadoop/mapred/JobClient.java src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java src/test/org/apache/hadoop/mapreduce/security/TestTokenCache.java
Date Wed, 13 Jun 2012 18:33:02 GMT
Author: tucu
Date: Wed Jun 13 18:33:01 2012
New Revision: 1349986

URL: http://svn.apache.org/viewvc?rev=1349986&view=rev
Log:
MAPREDUCE-3727. jobtoken location property in jobconf refers to wrong jobtoken file (tucu)

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/JobClient.java
    hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java
    hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapreduce/security/TestTokenCache.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1349986&r1=1349985&r2=1349986&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Wed Jun 13 18:33:01 2012
@@ -28,6 +28,9 @@ Release 1.2.0 - unreleased
     MAPREDUCE-4195. With invalid queueName request param, jobqueue_details.jsp 
     shows NPE (jira.shegalov via tucu)
 
+    MAPREDUCE-3727. jobtoken location property in jobconf refers to wrong 
+    jobtoken file (tucu)
+
 Release 1.1.0 - unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/JobClient.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/JobClient.java?rev=1349986&r1=1349985&r2=1349986&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/JobClient.java (original)
+++ hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/JobClient.java Wed
Jun 13 18:33:01 2012
@@ -909,6 +909,12 @@ public class JobClient extends Configure
             FileSystem.create(fs, submitJobFile,
                 new FsPermission(JobSubmissionFiles.JOB_FILE_PERMISSION));
 
+          // removing jobtoken referrals before copying the jobconf to HDFS
+          // as the tasks don't need this setting, actually they may break
+          // because of it if present as the referral will point to a
+          // different job.
+          TokenCache.cleanUpTokenReferral(jobCopy);
+
           try {
             jobCopy.writeXml(out);
           } finally {

Modified: hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java?rev=1349986&r1=1349985&r2=1349986&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java
(original)
+++ hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapreduce/security/TokenCache.java
Wed Jun 13 18:33:01 2012
@@ -52,6 +52,9 @@ public class TokenCache {
   
   private static final Log LOG = LogFactory.getLog(TokenCache.class);
 
+  static final String MAPREDUCE_JOB_CREDENTIALS_BINARY = 
+    "mapreduce.job.credentials.binary";
+
   /**
    * auxiliary method to get user's secret keys..
    * @param alias
@@ -79,6 +82,16 @@ public class TokenCache {
     obtainTokensForNamenodesInternal(credentials, ps, conf);
   }
 
+  /**
+   * Remove jobtoken referrals which don't make sense in the context
+   * of the task execution.
+   *
+   * @param conf configuration object.
+   */
+  public static void cleanUpTokenReferral(Configuration conf) {
+    conf.unset(MAPREDUCE_JOB_CREDENTIALS_BINARY);
+  }
+
   static void obtainTokensForNamenodesInternal(Credentials credentials,
                                                Path [] ps, 
                                                Configuration conf
@@ -99,7 +112,7 @@ public class TokenCache {
         if (readFile) {
           readFile = false;
           String binaryTokenFilename =
-            conf.get("mapreduce.job.credentials.binary");
+            conf.get(MAPREDUCE_JOB_CREDENTIALS_BINARY);
           if (binaryTokenFilename != null) {
             Credentials binary;
             try {

Modified: hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapreduce/security/TestTokenCache.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapreduce/security/TestTokenCache.java?rev=1349986&r1=1349985&r2=1349986&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapreduce/security/TestTokenCache.java
(original)
+++ hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapreduce/security/TestTokenCache.java
Wed Jun 13 18:33:01 2012
@@ -19,6 +19,7 @@ package org.apache.hadoop.mapreduce.secu
 
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -311,4 +312,15 @@ public class TestTokenCache {
     TokenCache.obtainTokensForNamenodesInternal(
       credentials, new Path [] {finalPath}, jConf);
   }
+
+
+  @Test
+  public void testCleanUpTokenReferral() throws Exception {
+    Configuration conf = new Configuration();
+    conf.set(TokenCache.MAPREDUCE_JOB_CREDENTIALS_BINARY, "foo");
+    TokenCache.cleanUpTokenReferral(conf);
+    assertNull(conf.get(TokenCache.MAPREDUCE_JOB_CREDENTIALS_BINARY));
+  }
+
+
 }



Mime
View raw message