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 ma...@apache.org on 2012/05/07 08:42:27 UTC

svn commit: r1334884 - in /hadoop/common/branches/branch-1.0: CHANGES.txt src/mapred/org/apache/hadoop/mapred/TaskLog.java

Author: mattf
Date: Mon May  7 06:42:27 2012
New Revision: 1334884

URL: http://svn.apache.org/viewvc?rev=1334884&view=rev
Log:
MAPREDUCE-4003 merged to branch-1.0

Modified:
    hadoop/common/branches/branch-1.0/CHANGES.txt   (contents, props changed)
    hadoop/common/branches/branch-1.0/src/mapred/org/apache/hadoop/mapred/TaskLog.java

Modified: hadoop/common/branches/branch-1.0/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.0/CHANGES.txt?rev=1334884&r1=1334883&r2=1334884&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.0/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1.0/CHANGES.txt Mon May  7 06:42:27 2012
@@ -83,6 +83,9 @@ Release 1.0.3 - unreleased
     MAPREDUCE-1238. mapred metrics shows negative count of waiting maps and
     reduces (tgraves via bobby)
 
+    MAPREDUCE-4003. log.index (No such file or directory) AND Task process 
+    exit with nonzero status of 126. (Koji Noguchi via tgraves)
+
 Release 1.0.2 - 2012.03.24
 
   NEW FEATURES

Propchange: hadoop/common/branches/branch-1.0/CHANGES.txt
------------------------------------------------------------------------------
  Merged /hadoop/common/branches/branch-1/CHANGES.txt:r1311994

Modified: hadoop/common/branches/branch-1.0/src/mapred/org/apache/hadoop/mapred/TaskLog.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.0/src/mapred/org/apache/hadoop/mapred/TaskLog.java?rev=1334884&r1=1334883&r2=1334884&view=diff
==============================================================================
--- hadoop/common/branches/branch-1.0/src/mapred/org/apache/hadoop/mapred/TaskLog.java (original)
+++ hadoop/common/branches/branch-1.0/src/mapred/org/apache/hadoop/mapred/TaskLog.java Mon May  7 06:42:27 2012
@@ -23,9 +23,11 @@ import java.io.BufferedReader;
 import java.io.DataOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Enumeration;
@@ -184,8 +186,22 @@ public class TaskLog {
         new HashMap<LogName, LogFileDetail>();
 
     File indexFile = getIndexFile(taskid, isCleanup);
-    BufferedReader fis = new BufferedReader(new InputStreamReader(
-      SecureIOUtils.openForRead(indexFile, obtainLogDirOwner(taskid))));
+    BufferedReader fis;
+    try {
+      fis = new BufferedReader(new InputStreamReader(
+        SecureIOUtils.openForRead(indexFile, obtainLogDirOwner(taskid))));
+    } catch (FileNotFoundException ex) {
+      LOG.warn("Index file for the log of " + taskid + " does not exist.");
+
+      //Assume no task reuse is used and files exist on attemptdir
+      StringBuffer input = new StringBuffer();
+      input.append(LogFileDetail.LOCATION
+                     + getAttemptDir(taskid, isCleanup) + "\n");
+      for (LogName logName : LOGS_TRACKED_BY_INDEX_FILES) {
+        input.append(logName + ":0 -1\n");
+      }
+      fis = new BufferedReader(new StringReader(input.toString()));
+    }
     //the format of the index file is
     //LOG_DIR: <the dir where the task logs are really stored>
     //stdout:<start-offset in the stdout file> <length>
@@ -193,7 +209,7 @@ public class TaskLog {
     //syslog:<start-offset in the syslog file> <length>
     String str = fis.readLine();
     if (str == null) { //the file doesn't have anything
-      throw new IOException ("Index file for the log of " + taskid+" doesn't exist.");
+      throw new IOException ("Index file for the log of " + taskid+" is empty.");
     }
     String loc = str.substring(str.indexOf(LogFileDetail.LOCATION)+
         LogFileDetail.LOCATION.length());