Ver código fonte

Merge -r 758155:758156 from trunk onto 0.19 branch. Fixes HADOOP-5374.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19@758158 13f79535-47bb-0310-9956-ffa450edef68
Devaraj Das 16 anos atrás
pai
commit
27ffeab1a0

+ 3 - 0
CHANGES.txt

@@ -92,6 +92,9 @@ Release 0.19.2 - Unreleased
     HADOOP-4719. Fix documentation of 'ls' format for FsShell. (Ravi Phulari
     via cdouglas)
 
+    HADOOP-5374. Fixes a NPE problem in getTasksToSave method.
+    (Amareshwari Sriramadasu via ddas)
+
 Release 0.19.1 - 2009-02-23 
 
     HADOOP-5225. Workaround for tmp file handling in HDFS. sync() is 

+ 7 - 8
src/mapred/org/apache/hadoop/mapred/TaskInProgress.java

@@ -414,7 +414,8 @@ class TaskInProgress {
    * Returns whether the task attempt should be committed or not 
    */
   public boolean shouldCommit(TaskAttemptID taskid) {
-    return !isComplete() && taskToCommit.equals(taskid);
+    return !isComplete() && isCommitPending(taskid) && 
+           taskToCommit.equals(taskid);
   }
 
   /**
@@ -519,14 +520,12 @@ class TaskInProgress {
         return false;
       }
       
+      //Do not accept any status once the task is marked FAILED/KILLED
       //This is to handle the case of the JobTracker timing out a task
-      //due to launch delay, but the TT comes back with one of the 
-      //states mentioned in the newState
-      if (oldState == TaskStatus.State.FAILED && 
-          (newState == TaskStatus.State.UNASSIGNED ||
-           newState == TaskStatus.State.RUNNING || 
-           newState == TaskStatus.State.COMMIT_PENDING ||
-           newState == TaskStatus.State.SUCCEEDED)) {
+      //due to launch delay, but the TT comes back with any state or 
+      //TT got expired
+      if (oldState == TaskStatus.State.FAILED ||
+          oldState == TaskStatus.State.KILLED) {
         tasksToKill.put(taskid, true);
         return false;	  
       }