Pārlūkot izejas kodu

HADOOP-1318. Completed maps are not failed if the number of reducers are zero. Contributed by Amareshwari Sriramadasu.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@659001 13f79535-47bb-0310-9956-ffa450edef68
Devaraj Das 17 gadi atpakaļ
vecāks
revīzija
315af98a4d
2 mainītis faili ar 11 papildinājumiem un 4 dzēšanām
  1. 3 0
      CHANGES.txt
  2. 8 4
      src/java/org/apache/hadoop/mapred/JobTracker.java

+ 3 - 0
CHANGES.txt

@@ -314,6 +314,9 @@ Trunk (unreleased changes)
     HADOOP-3403. Fixes a problem in the JobTracker to do with handling of lost
     tasktrackers. (Arun Murthy via ddas)
 
+    HADOOP-1318. Completed maps are not failed if the number of reducers are
+    zero. (Amareshwari Sriramadasu via ddas).
+
 Release 0.17.0 - 2008-05-18
 
   INCOMPATIBLE CHANGES

+ 8 - 4
src/java/org/apache/hadoop/mapred/JobTracker.java

@@ -2069,11 +2069,14 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
       Set<JobInProgress> jobsWithFailures = new HashSet<JobInProgress>(); 
       for (TaskAttemptID taskId : lostTasks) {
         TaskInProgress tip = taskidToTIPMap.get(taskId);
+        JobInProgress job = tip.getJob();
 
         // Completed reduce tasks never need to be failed, because 
         // their outputs go to dfs
-        if (tip.isMapTask() || !tip.isComplete()) {
-          JobInProgress job = tip.getJob();
+        // And completed maps with zero reducers of the job 
+        // never need to be failed. 
+        if (!tip.isComplete() || 
+            (tip.isMapTask() && job.desiredReduces() != 0)) {
           // if the job is done, we don't want to change anything
           if (job.getStatus().getRunState() == JobStatus.RUNNING) {
             job.failedTask(tip, taskId, ("Lost task tracker: " + trackerName), 
@@ -2083,8 +2086,9 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
                            TaskStatus.State.KILLED, trackerName, myMetrics);
             jobsWithFailures.add(job);
           }
-        } else if (!tip.isMapTask() && tip.isComplete()) {
-          // Completed 'reduce' task, not failed;
+        } else {
+          // Completed 'reduce' task and completed 'maps' with zero 
+          // reducers of the job, not failed;
           // only removed from data-structures.
           markCompletedTaskAttempt(trackerName, taskId);
         }