Browse Source

HADOOP-1281. Ensure running tasks of completed map TIPs (e.g. speculative tasks) are killed as soon as the TIP completed.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@610523 13f79535-47bb-0310-9956-ffa450edef68
Arun Murthy 17 years ago
parent
commit
ba22e6a7a1
2 changed files with 18 additions and 10 deletions
  1. 3 0
      CHANGES.txt
  2. 15 10
      src/java/org/apache/hadoop/mapred/TaskInProgress.java

+ 3 - 0
CHANGES.txt

@@ -381,6 +381,9 @@ Trunk (unreleased changes)
     HADOOP-2537. Make build process compatible with Ant 1.7.0.
     (Hrishikesh via nigel)
 
+    HADOOP-1281. Ensure running tasks of completed map TIPs (e.g. speculative
+    tasks) are killed as soon as the TIP completed. (acmurthy)
+
 Release 0.15.2 - 2008-01-02
 
   BUG FIXES

+ 15 - 10
src/java/org/apache/hadoop/mapred/TaskInProgress.java

@@ -320,23 +320,28 @@ class TaskInProgress {
    * or the task is killed by the user
    */
   public boolean shouldClose(String taskid) {
-    // If the thing has never been closed,
-    // and it belongs to this TIP,
-    // and this TIP is somehow FINISHED,
-    // then true
+    /**
+     * If the task hasn't been closed yet, and it belongs to a completed
+     * TaskInProgress close it.
+     * 
+     * However, for completed map tasks we do not close the task which
+     * actually was the one responsible for _completing_ the TaskInProgress. 
+     */
+    boolean close = false;
     TaskStatus ts = taskStatuses.get(taskid);
     if ((ts != null) &&
         (!tasksReportedClosed.contains(taskid)) &&
         (job.getStatus().getRunState() != JobStatus.RUNNING)) {
       tasksReportedClosed.add(taskid);
-      return true;
-    } else if (!isMapTask() && isComplete() && 
-               !tasksReportedClosed.contains(taskid)){
+      close = true;
+    } else if (isComplete() && !(isMapTask() && isComplete(taskid)) &&
+               !tasksReportedClosed.contains(taskid)) {
       tasksReportedClosed.add(taskid);
-      return true; 
+      close = true; 
     } else {
-      return tasksToKill.keySet().contains(taskid);
-    }
+      close = tasksToKill.keySet().contains(taskid);
+    }   
+    return close;
   }
 
   /**