MAPREDUCE-6009. Map-only job with new-api runs wrong OutputCommitter when cleanup scheduled in a reduce slot (Gera Shegalov via Sandy Ryza)
diff --git a/src/mapred/org/apache/hadoop/mapreduce/Job.java b/src/mapred/org/apache/hadoop/mapreduce/Job.java
index e3df019..5ca47fb 100644
--- a/src/mapred/org/apache/hadoop/mapreduce/Job.java
+++ b/src/mapred/org/apache/hadoop/mapreduce/Job.java
@@ -521,9 +521,9 @@
         ensureNotSet(JobContext.OUTPUT_FORMAT_CLASS_ATTR, mode);
       }
     }
+    conf.setBooleanIfUnset("mapred.reducer.new-api",
+                           conf.get(oldReduceClass) == null);
     if (numReduces != 0) {
-      conf.setBooleanIfUnset("mapred.reducer.new-api",
-                             conf.get(oldReduceClass) == null);
       if (conf.getUseNewReducer()) {
         String mode = "new reduce API";
         ensureNotSet("mapred.output.format.class", mode);