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 dd...@apache.org on 2009/03/19 11:39:09 UTC

svn commit: r755905 - in /hadoop/core/trunk: CHANGES.txt src/mapred/org/apache/hadoop/mapred/Child.java

Author: ddas
Date: Thu Mar 19 10:39:09 2009
New Revision: 755905

URL: http://svn.apache.org/viewvc?rev=755905&view=rev
Log:
HADOOP-5471. Fixes a problem to do with updating the log.index file in the case where a cleanup task is run. Contributed by Amareshwari Sriramadasu.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/Child.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=755905&r1=755904&r2=755905&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Mar 19 10:39:09 2009
@@ -1041,6 +1041,9 @@
 
     HADOOP-5382. Support combiners in the new context object API. (omalley)
 
+    HADOOP-5471. Fixes a problem to do with updating the log.index file in the 
+    case where a cleanup task is run. (Amareshwari Sriramadasu via ddas)
+
 Release 0.19.2 - Unreleased
 
   BUG FIXES

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/Child.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/Child.java?rev=755905&r1=755904&r2=755905&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/Child.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/Child.java Thu Mar 19 10:39:09 2009
@@ -46,7 +46,7 @@
   public static final Log LOG =
     LogFactory.getLog(TaskTracker.class);
 
-  static volatile TaskAttemptID taskid;
+  static volatile TaskAttemptID taskid = null;
   static volatile boolean isCleanup;
 
   public static void main(String[] args) throws Throwable {
@@ -58,9 +58,8 @@
     InetSocketAddress address = new InetSocketAddress(host, port);
     final TaskAttemptID firstTaskid = TaskAttemptID.forName(args[2]);
     final int SLEEP_LONGER_COUNT = 5;
-    taskid = firstTaskid;
     int jvmIdInt = Integer.parseInt(args[3]);
-    JVMId jvmId = new JVMId(taskid.getJobID(),taskid.isMap(),jvmIdInt);
+    JVMId jvmId = new JVMId(firstTaskid.getJobID(),firstTaskid.isMap(),jvmIdInt);
     TaskUmbilicalProtocol umbilical =
       (TaskUmbilicalProtocol)RPC.getProxy(TaskUmbilicalProtocol.class,
           TaskUmbilicalProtocol.versionID,
@@ -98,6 +97,7 @@
     Task task = null;
     try {
       while (true) {
+        taskid = null;
         JvmTask myTask = umbilical.getTask(jvmId);
         if (myTask.shouldDie()) {
           break;
@@ -180,7 +180,9 @@
       // Report back any failures, for diagnostic purposes
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       throwable.printStackTrace(new PrintStream(baos));
-      umbilical.reportDiagnosticInfo(taskid, baos.toString());
+      if (taskid != null) {
+        umbilical.reportDiagnosticInfo(taskid, baos.toString());
+      }
     } finally {
       RPC.stopProxy(umbilical);
       MetricsContext metricsContext = MetricsUtil.getContext("mapred");
@@ -189,6 +191,10 @@
       // This assumes that on return from Task.run() 
       // there is no more logging done.
       LogManager.shutdown();
+      // do synclogs
+      if (taskid != null) {
+        TaskLog.syncLogs(firstTaskid, taskid, isCleanup);
+      }
     }
   }
 }