Browse Source

HADOOP-2016. Ignore status-updates from FAILED/KILLED tasks at the TaskTracker. This fixes a race-condition which caused the tasks to wrongly remain in the RUNNING state even after being killed by the JobTracker and thus handicap the cleanup of the task's output sub-directory. Contributed by Arun.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@584187 13f79535-47bb-0310-9956-ffa450edef68
Arun Murthy 18 years ago
parent
commit
5e72a302dc
2 changed files with 16 additions and 4 deletions
  1. 5 0
      CHANGES.txt
  2. 11 4
      src/java/org/apache/hadoop/mapred/TaskTracker.java

+ 5 - 0
CHANGES.txt

@@ -286,6 +286,11 @@ Trunk (unreleased changes)
 
     HADOOP-2036. Fix a NullPointerException in JvmMetrics class. (nigel)
 
+    HADOOP-2016.  Ignore status-updates from FAILED/KILLED tasks at the 
+    TaskTracker. This fixes a race-condition which caused the tasks to wrongly 
+    remain in the RUNNING state even after being killed by the JobTracker and
+    thus handicap the cleanup of the task's output sub-directory. (acmurthy)
+
   IMPROVEMENTS
 
     HADOOP-1908. Restructure data node code so that block sending and 

+ 11 - 4
src/java/org/apache/hadoop/mapred/TaskTracker.java

@@ -1324,14 +1324,21 @@ public class TaskTracker
      */
     public synchronized void reportProgress(TaskStatus taskStatus) 
     {
-      if (this.done) {
+      LOG.info(task.getTaskId() + " " + taskStatus.getProgress() + 
+          "% " + taskStatus.getStateString());
+      
+      if (this.done || 
+          this.taskStatus.getRunState() != TaskStatus.State.RUNNING) {
         //make sure we ignore progress messages after a task has 
-        //invoked TaskUmbilicalProtocol.done()
+        //invoked TaskUmbilicalProtocol.done() or if the task has been
+        //KILLED/FAILED
+        LOG.info(task.getTaskId() + " Ignoring status-update since " +
+                 ((this.done) ? "task is 'done'" : 
+                                ("runState: " + this.taskStatus.getRunState()))
+                 ); 
         return;
       }
       
-      LOG.info(task.getTaskId() + " " + taskStatus.getProgress() + 
-               "% " + taskStatus.getStateString());
       this.taskStatus.statusUpdate(taskStatus);
       this.lastProgressReport = System.currentTimeMillis();
     }