Selaa lähdekoodia

Merge -r 604261:604262 from trunk to 0.15 branch. Fixes HADOOP-2378.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/branches/branch-0.15@604268 13f79535-47bb-0310-9956-ffa450edef68
Devaraj Das 17 vuotta sitten
vanhempi
commit
d9b4e0c0cf
2 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 3 0
      CHANGES.txt
  2. 8 1
      src/java/org/apache/hadoop/mapred/JobInProgress.java

+ 3 - 0
CHANGES.txt

@@ -15,6 +15,9 @@ Branch 0.15 (unreleased)
     HDFS but not the default filesystem.  HDFS paths returned by the
     listStatus() method are now fully-qualified.  (cutting)
 
+    HADOOP-2378.  Fixes a problem where the last task completion event would
+    get created after the job completes. (Alejandro Abdelnur via ddas)
+
   IMPROVEMENTS
 
     HADOOP-2160.  Remove project-level, non-user documentation from

+ 8 - 1
src/java/org/apache/hadoop/mapred/JobInProgress.java

@@ -397,7 +397,6 @@ class JobInProgress {
 
       TaskCompletionEvent taskEvent = null;
       if (state == TaskStatus.State.SUCCEEDED) {
-        completedTask(tip, status, metrics);
         taskEvent = new TaskCompletionEvent(
                                             taskCompletionEventTracker, 
                                             status.getTaskId(),
@@ -448,9 +447,17 @@ class JobInProgress {
       }          
 
       // Add the 'complete' task i.e. successful/failed
+      // It _is_ safe to add the TaskCompletionEvent.Status.SUCCEEDED
+      // *before* calling TIP.completedTask since:
+      // a. One and only one task of a TIP is declared as a SUCCESS, the
+      //    other (speculative tasks) are marked KILLED by the TaskCommitThread
+      // b. TIP.completedTask *does not* throw _any_ exception at all.
       if (taskEvent != null) {
         this.taskCompletionEvents.add(taskEvent);
         taskCompletionEventTracker++;
+        if (state == TaskStatus.State.SUCCEEDED) {
+          completedTask(tip, status, metrics);
+        }
       }
     }