MAPREDUCE-4641. Exception in commitJob marks job as successful in job history (Jason Lowe via bobby)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1381784 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9da626af41
commit
09038b741d
|
@ -883,6 +883,9 @@ Release 0.23.3 - UNRELEASED
|
|||
MAPREDUCE-4633. history server doesn't set permissions on all subdirs
|
||||
(tgraves via bobby)
|
||||
|
||||
MAPREDUCE-4641. Exception in commitJob marks job as successful in job
|
||||
history (Jason Lowe via bobby)
|
||||
|
||||
Release 0.23.2 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -759,7 +759,8 @@ public class JobImpl implements org.apache.hadoop.mapreduce.v2.app.job.Job,
|
|||
job.getCommitter().commitJob(job.getJobContext());
|
||||
} catch (IOException e) {
|
||||
LOG.error("Could not do commit for Job", e);
|
||||
job.logJobHistoryFinishedEvent();
|
||||
job.addDiagnostic("Job commit failed: " + e.getMessage());
|
||||
job.abortJob(org.apache.hadoop.mapreduce.JobStatus.State.FAILED);
|
||||
return job.finished(JobState.FAILED);
|
||||
}
|
||||
job.logJobHistoryFinishedEvent();
|
||||
|
@ -1199,7 +1200,7 @@ public class JobImpl implements org.apache.hadoop.mapreduce.v2.app.job.Job,
|
|||
}
|
||||
}
|
||||
|
||||
private void abortJob(
|
||||
protected void abortJob(
|
||||
org.apache.hadoop.mapreduce.JobStatus.State finalState) {
|
||||
try {
|
||||
committer.abortJob(jobContext, finalState);
|
||||
|
@ -1501,7 +1502,7 @@ public class JobImpl implements org.apache.hadoop.mapreduce.v2.app.job.Job,
|
|||
}
|
||||
}
|
||||
|
||||
private void addDiagnostic(String diag) {
|
||||
protected void addDiagnostic(String diag) {
|
||||
diagnostics.add(diag);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,11 @@
|
|||
package org.apache.hadoop.mapreduce.v2.app.job.impl;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -91,8 +93,6 @@ public class TestJobImpl {
|
|||
when(mockJob.getCommitter()).thenReturn(mockCommitter);
|
||||
when(mockJob.getEventHandler()).thenReturn(mockEventHandler);
|
||||
when(mockJob.getJobContext()).thenReturn(mockJobContext);
|
||||
doNothing().when(mockJob).setFinishTime();
|
||||
doNothing().when(mockJob).logJobHistoryFinishedEvent();
|
||||
when(mockJob.finished(JobState.KILLED)).thenReturn(JobState.KILLED);
|
||||
when(mockJob.finished(JobState.FAILED)).thenReturn(JobState.FAILED);
|
||||
when(mockJob.finished(JobState.SUCCEEDED)).thenReturn(JobState.SUCCEEDED);
|
||||
|
@ -103,11 +103,13 @@ public class TestJobImpl {
|
|||
// commitJob stubbed out, so this can't happen
|
||||
}
|
||||
doNothing().when(mockEventHandler).handle(any(JobHistoryEvent.class));
|
||||
JobState jobState = JobImpl.checkJobCompleteSuccess(mockJob);
|
||||
Assert.assertNotNull("checkJobCompleteSuccess incorrectly returns null " +
|
||||
"for successful job",
|
||||
JobImpl.checkJobCompleteSuccess(mockJob));
|
||||
"for successful job", jobState);
|
||||
Assert.assertEquals("checkJobCompleteSuccess returns incorrect state",
|
||||
JobState.FAILED, JobImpl.checkJobCompleteSuccess(mockJob));
|
||||
JobState.FAILED, jobState);
|
||||
verify(mockJob).abortJob(
|
||||
eq(org.apache.hadoop.mapreduce.JobStatus.State.FAILED));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue