Browse Source

HADOOP-5869. Fix bug in assignment of setup / cleanup task that was causing TestQueueCapacities to fail. Contributed by Sreekanth Ramakrishnan.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@783672 13f79535-47bb-0310-9956-ffa450edef68
Hemanth Yamijala 16 năm trước cách đây
mục cha
commit
5c247642bf

+ 4 - 0
CHANGES.txt

@@ -921,6 +921,10 @@ Release 0.20.1 - Unreleased
     HADOOP-5884. Fixes accounting in capacity scheduler so that high RAM jobs
     take more slots. (Vinod Kumar Vavilapalli via yhemanth)
 
+    HADOOP-5869. Fix bug in assignment of setup / cleanup task that was
+    causing TestQueueCapacities to fail.
+    (Sreekanth Ramakrishnan via yhemanth)
+
 Release 0.20.0 - 2009-04-15
 
   INCOMPATIBLE CHANGES

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

@@ -919,18 +919,19 @@ class TaskInProgress {
                              boolean taskCleanup) {
     // create the task
     Task t = null;
-    if (isMapTask() && !jobSetup && !jobCleanup) {
+    if (isMapTask()) {
       LOG.debug("attempt " + numTaskFailures + " sending skippedRecords "
           + failedRanges.getIndicesCount());
-
-      t =
-          new MapTask(jobFile, taskid, partition, rawSplit.getClassName(),
-              rawSplit.getBytes());
-
-    } else if (jobSetup || jobCleanup) {
-      t = new MapTask(jobFile, taskid, partition, null, new BytesWritable());
-    }
-    else {
+      String splitClass = null;
+      BytesWritable split;
+      if (!jobSetup && !jobCleanup) {
+        splitClass = rawSplit.getClassName();
+        split = rawSplit.getBytes();
+      } else {
+        split = new BytesWritable();
+      }
+      t = new MapTask(jobFile, taskid, partition, splitClass, split);
+    } else {
       t = new ReduceTask(jobFile, taskid, partition, numMaps);
     }
     if (jobCleanup) {

+ 3 - 1
src/test/mapred/org/apache/hadoop/mapred/ControlledMapReduceJob.java

@@ -416,6 +416,8 @@ class ControlledMapReduceJob extends Configured implements Tool,
     conf.setInputFormat(ControlledMapReduceJob.class);
     FileInputFormat.addInputPath(conf, new Path("ignored"));
     conf.setOutputFormat(NullOutputFormat.class);
+    conf.setMapSpeculativeExecution(false);
+    conf.setReduceSpeculativeExecution(false);
 
     // Set the following for reduce tasks to be able to be started running
     // immediately along with maps.
@@ -573,4 +575,4 @@ class ControlledMapReduceJob extends Configured implements Tool,
       return new ControlledMapReduceJobRunner(conf, numMappers, numReducers);
     }
   }
-}
+}