MAPREDUCE-6194. Bubble up final exception in failures during creation of output collectors. Contributed by Varun Saxena.

(cherry picked from commit 298d09c9b5)
This commit is contained in:
Harsh J 2014-12-15 14:26:22 +05:30
parent 6465931c19
commit a3fa1f0761
2 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,9 @@ Release 2.7.0 - UNRELEASED
IMPROVEMENTS
MAPREDUCE-6194. Bubble up final exception in failures during creation
of output collectors (Varun Saxena via harsh)
MAPREDUCE-5420. Remove mapreduce.task.tmp.dir from mapred-default.xml
(James Carman via harsh)

View File

@ -387,6 +387,7 @@ public class MapTask extends Task {
Class<?>[] collectorClasses = job.getClasses(
JobContext.MAP_OUTPUT_COLLECTOR_CLASS_ATTR, MapOutputBuffer.class);
int remainingCollectors = collectorClasses.length;
Exception lastException = null;
for (Class clazz : collectorClasses) {
try {
if (!MapOutputCollector.class.isAssignableFrom(clazz)) {
@ -406,10 +407,12 @@ public class MapTask extends Task {
if (--remainingCollectors > 0) {
msg += " (" + remainingCollectors + " more collector(s) to try)";
}
lastException = e;
LOG.warn(msg, e);
}
}
throw new IOException("Unable to initialize any output collector");
throw new IOException("Initialization of all the collectors failed. " +
"Error in last collector was :" + lastException.getMessage(), lastException);
}
@SuppressWarnings("unchecked")