hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077133 - in /hadoop/common/branches/branch-0.20-security-patches/src: mapred/org/apache/hadoop/mapred/TaskTracker.java test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java
Date Fri, 04 Mar 2011 03:44:19 GMT
Author: omalley
Date: Fri Mar  4 03:44:18 2011
New Revision: 1077133

URL: http://svn.apache.org/viewvc?rev=1077133&view=rev
Log:
commit f1e5da4123246f98124a516e93ecdfa3104d9f9c
Author: Hemanth Yamijala <yhemanth@friendchild-lm.(none)>
Date:   Fri Jan 29 00:00:30 2010 +0530

    MAPREDUCE:842 (follow-up patch to fix a backport bug) from https://issues.apache.org/jira/secure/attachment/12431690/MR-842-follow-up.patch
    
    +++ b/YAHOO-CHANGES.txt
    +    MAPREDUCE-842. Fixing a bug in the earlier version of the patch
    +    related to improper localization of the job token file.
    +    (Ravi Gummadi via yhemanth)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskTracker.java
    hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskTracker.java?rev=1077133&r1=1077132&r2=1077133&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskTracker.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/TaskTracker.java
Fri Mar  4 03:44:18 2011
@@ -922,8 +922,7 @@ public class TaskTracker 
         rjob.jobConf = localJobConf;  
         rjob.keepJobFiles = ((localJobConf.getKeepTaskFilesPattern() != null) ||
                              localJobConf.getKeepFailedTaskFiles());
-        // save local copy of JobToken file
-        localizeJobTokenFile(t.getUser(), jobId, localJobConf);       
+
         TokenStorage ts = TokenCache.loadTokens(rjob.jobConf);
         Token<JobTokenIdentifier> jt = (Token<JobTokenIdentifier>)ts.getJobToken();

         getJobTokenSecretManager().addTokenForJob(jobId.toString(), jt);
@@ -985,6 +984,9 @@ public class TaskTracker 
     // Download the job.jar for this job from the system FS
     localizeJobJarFile(userName, jobId, userFs, localJobConf);
 
+    // save local copy of JobToken file
+    localizeJobTokenFile(userName, jobId, localJobConf);
+
     return localJobConf;
   }
 

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java?rev=1077133&r1=1077132&r2=1077133&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestTaskTrackerLocalization.java
Fri Mar  4 03:44:18 2011
@@ -33,7 +33,10 @@ import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.LocalDirAllocator;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.mapreduce.server.tasktracker.Localizer;
+import org.apache.hadoop.mapreduce.security.SecureShuffleUtils;
+import org.apache.hadoop.mapreduce.security.token.JobTokenIdentifier;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.util.Shell;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.mapred.JvmManager.JvmEnv;
@@ -129,6 +132,7 @@ public class TestTaskTrackerLocalization
 
     // for test case system FS is the local FS
     tracker.systemFS = FileSystem.getLocal(trackerFConf);
+    tracker.systemDirectory = new Path(TEST_ROOT_DIR.getAbsolutePath());
     tracker.setLocalFileSystem(tracker.systemFS);
     
     taskTrackerUGI = UserGroupInformation.login(trackerFConf);
@@ -142,6 +146,9 @@ public class TestTaskTrackerLocalization
         new MapTask(jobConfFile.toURI().toString(), taskId, 1, null, 1);
     task.setConf(jobConf); // Set conf. Set user name in particular.
 
+    // create jobTokens file
+    uploadJobTokensFile();
+
     taskController = new DefaultTaskController();
     taskController.setConf(trackerFConf);
     taskController.setup();
@@ -189,6 +196,25 @@ public class TestTaskTrackerLocalization
     return jobConfFile;
    }
   
+  /**
+   * create fake JobTokens file
+   * @return
+   * @throws IOException
+   */
+  protected void uploadJobTokensFile() throws IOException {
+
+    File dir = new File(TEST_ROOT_DIR, jobId.toString());
+    if(!dir.exists())
+      assertTrue("faild to create dir="+dir.getAbsolutePath(), dir.mkdirs());
+
+    File jobTokenFile = new File(dir, SecureShuffleUtils.JOB_TOKEN_FILENAME);
+    FileOutputStream fos = new FileOutputStream(jobTokenFile);
+    java.io.DataOutputStream out = new java.io.DataOutputStream(fos);
+    Token<JobTokenIdentifier> jt = new Token<JobTokenIdentifier>();
+    jt.write(out); // writing empty file, we don't need the keys for this test
+    out.close();
+  }
+
   @Override
   protected void tearDown()
       throws Exception {



Mime
View raw message