You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:38:36 UTC

svn commit: r1077633 - /hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobHistory.java

Author: omalley
Date: Fri Mar  4 04:38:36 2011
New Revision: 1077633

URL: http://svn.apache.org/viewvc?rev=1077633&view=rev
Log:
commit 1be7d85ece9b29cb76a9bddcc19b004770152887
Author: Arun C Murthy <ac...@apache.org>
Date:   Tue Aug 3 15:33:44 2010 -0700

    MAPREDUCE-291. Fixed initialization of job-history. Contributed by Srikanth Sundarrajan.

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

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobHistory.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobHistory.java?rev=1077633&r1=1077632&r2=1077633&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobHistory.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobHistory.java Fri Mar  4 04:38:36 2011
@@ -496,15 +496,11 @@ public class JobHistory {
    */
   public static void init(JobTracker jobTracker, JobConf conf,
              String hostname, long jobTrackerStartTime) throws IOException {
-    LOG_DIR = conf.get("hadoop.job.history.location" ,
-      "file:///" + new File(
-      System.getProperty("hadoop.log.dir")).getAbsolutePath()
-      + File.separator + "history");
+    initLogDir(conf);
     JOBTRACKER_UNIQUE_STRING = hostname + "_" + 
                                   String.valueOf(jobTrackerStartTime) + "_";
     jobtrackerHostname = hostname;
     Path logDir = new Path(LOG_DIR);
-    LOGDIR_FS = logDir.getFileSystem(conf);
     if (!LOGDIR_FS.exists(logDir)){
       if (!LOGDIR_FS.mkdirs(logDir, new FsPermission(HISTORY_DIR_PERMISSION))) {
         throw new IOException("Mkdirs failed to create " + logDir.toString());
@@ -524,6 +520,15 @@ public class JobHistory {
     fileManager = new JobHistoryFilesManager(conf, jobTracker);
   }
 
+  private static void initLogDir(JobConf conf) throws IOException {
+    LOG_DIR = conf.get("hadoop.job.history.location" ,
+      "file:///" + new File(
+      System.getProperty("hadoop.log.dir")).getAbsolutePath()
+      + File.separator + "history");
+    Path logDir = new Path(LOG_DIR);
+    LOGDIR_FS = logDir.getFileSystem(conf);
+  }
+
   static void initDone(JobConf conf, FileSystem fs) throws IOException {
     initDone(conf, fs, true);
   }
@@ -538,6 +543,9 @@ public class JobHistory {
       DONE = fs.makeQualified(new Path(doneLocation));
       DONEDIR_FS = fs;
     } else {
+      if (!setup) {
+        initLogDir(conf);
+      }
       DONE = new Path(LOG_DIR, "done");
       DONEDIR_FS = LOGDIR_FS;
     }