MAPREDUCE-4748. Invalid event: T_ATTEMPT_SUCCEEDED at SUCCEEDED. Contributed by Jason Lowe
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1402658 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b54e794fb0
commit
286c171987
|
@ -613,6 +613,8 @@ Release 0.23.5 - UNRELEASED
|
||||||
MAPREDUCE-4730. Fix Reducer's EventFetcher to scale the map-completion
|
MAPREDUCE-4730. Fix Reducer's EventFetcher to scale the map-completion
|
||||||
requests slowly to avoid HADOOP-8942. (Jason Lowe via vinodkv)
|
requests slowly to avoid HADOOP-8942. (Jason Lowe via vinodkv)
|
||||||
|
|
||||||
|
MAPREDUCE-4748. Invalid event: T_ATTEMPT_SUCCEEDED at SUCCEEDED. (jlowe)
|
||||||
|
|
||||||
Release 0.23.4 - UNRELEASED
|
Release 0.23.4 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -203,7 +203,10 @@ public abstract class TaskImpl implements Task, EventHandler<TaskEvent> {
|
||||||
.addTransition(
|
.addTransition(
|
||||||
TaskStateInternal.SUCCEEDED, TaskStateInternal.SUCCEEDED,
|
TaskStateInternal.SUCCEEDED, TaskStateInternal.SUCCEEDED,
|
||||||
EnumSet.of(TaskEventType.T_ADD_SPEC_ATTEMPT,
|
EnumSet.of(TaskEventType.T_ADD_SPEC_ATTEMPT,
|
||||||
TaskEventType.T_ATTEMPT_LAUNCHED))
|
TaskEventType.T_ATTEMPT_COMMIT_PENDING,
|
||||||
|
TaskEventType.T_ATTEMPT_LAUNCHED,
|
||||||
|
TaskEventType.T_ATTEMPT_SUCCEEDED,
|
||||||
|
TaskEventType.T_KILL))
|
||||||
|
|
||||||
// Transitions from FAILED state
|
// Transitions from FAILED state
|
||||||
.addTransition(TaskStateInternal.FAILED, TaskStateInternal.FAILED,
|
.addTransition(TaskStateInternal.FAILED, TaskStateInternal.FAILED,
|
||||||
|
|
|
@ -418,6 +418,21 @@ public class TestTaskImpl {
|
||||||
killRunningTaskAttempt(getLastAttempt().getAttemptId());
|
killRunningTaskAttempt(getLastAttempt().getAttemptId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testKillSuccessfulTask() {
|
||||||
|
LOG.info("--- START: testKillSuccesfulTask ---");
|
||||||
|
mockTask = createMockTask(TaskType.MAP);
|
||||||
|
TaskId taskId = getNewTaskID();
|
||||||
|
scheduleTaskAttempt(taskId);
|
||||||
|
launchTaskAttempt(getLastAttempt().getAttemptId());
|
||||||
|
commitTaskAttempt(getLastAttempt().getAttemptId());
|
||||||
|
mockTask.handle(new TaskTAttemptEvent(getLastAttempt().getAttemptId(),
|
||||||
|
TaskEventType.T_ATTEMPT_SUCCEEDED));
|
||||||
|
assertTaskSucceededState();
|
||||||
|
mockTask.handle(new TaskEvent(taskId, TaskEventType.T_KILL));
|
||||||
|
assertTaskSucceededState();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTaskProgress() {
|
public void testTaskProgress() {
|
||||||
LOG.info("--- START: testTaskProgress ---");
|
LOG.info("--- START: testTaskProgress ---");
|
||||||
|
@ -485,7 +500,8 @@ public class TestTaskImpl {
|
||||||
assertTaskSucceededState();
|
assertTaskSucceededState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runSpeculativeTaskAttemptSucceedsEvenIfFirstFails(TaskEventType failEvent) {
|
private void runSpeculativeTaskAttemptSucceeds(
|
||||||
|
TaskEventType firstAttemptFinishEvent) {
|
||||||
TaskId taskId = getNewTaskID();
|
TaskId taskId = getNewTaskID();
|
||||||
scheduleTaskAttempt(taskId);
|
scheduleTaskAttempt(taskId);
|
||||||
launchTaskAttempt(getLastAttempt().getAttemptId());
|
launchTaskAttempt(getLastAttempt().getAttemptId());
|
||||||
|
@ -502,9 +518,9 @@ public class TestTaskImpl {
|
||||||
// The task should now have succeeded
|
// The task should now have succeeded
|
||||||
assertTaskSucceededState();
|
assertTaskSucceededState();
|
||||||
|
|
||||||
// Now fail the first task attempt, after the second has succeeded
|
// Now complete the first task attempt, after the second has succeeded
|
||||||
mockTask.handle(new TaskTAttemptEvent(taskAttempts.get(0).getAttemptId(),
|
mockTask.handle(new TaskTAttemptEvent(taskAttempts.get(0).getAttemptId(),
|
||||||
failEvent));
|
firstAttemptFinishEvent));
|
||||||
|
|
||||||
// The task should still be in the succeeded state
|
// The task should still be in the succeeded state
|
||||||
assertTaskSucceededState();
|
assertTaskSucceededState();
|
||||||
|
@ -513,25 +529,36 @@ public class TestTaskImpl {
|
||||||
@Test
|
@Test
|
||||||
public void testMapSpeculativeTaskAttemptSucceedsEvenIfFirstFails() {
|
public void testMapSpeculativeTaskAttemptSucceedsEvenIfFirstFails() {
|
||||||
mockTask = createMockTask(TaskType.MAP);
|
mockTask = createMockTask(TaskType.MAP);
|
||||||
runSpeculativeTaskAttemptSucceedsEvenIfFirstFails(TaskEventType.T_ATTEMPT_FAILED);
|
runSpeculativeTaskAttemptSucceeds(TaskEventType.T_ATTEMPT_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReduceSpeculativeTaskAttemptSucceedsEvenIfFirstFails() {
|
public void testReduceSpeculativeTaskAttemptSucceedsEvenIfFirstFails() {
|
||||||
mockTask = createMockTask(TaskType.REDUCE);
|
mockTask = createMockTask(TaskType.REDUCE);
|
||||||
runSpeculativeTaskAttemptSucceedsEvenIfFirstFails(TaskEventType.T_ATTEMPT_FAILED);
|
runSpeculativeTaskAttemptSucceeds(TaskEventType.T_ATTEMPT_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMapSpeculativeTaskAttemptSucceedsEvenIfFirstIsKilled() {
|
public void testMapSpeculativeTaskAttemptSucceedsEvenIfFirstIsKilled() {
|
||||||
mockTask = createMockTask(TaskType.MAP);
|
mockTask = createMockTask(TaskType.MAP);
|
||||||
runSpeculativeTaskAttemptSucceedsEvenIfFirstFails(TaskEventType.T_ATTEMPT_KILLED);
|
runSpeculativeTaskAttemptSucceeds(TaskEventType.T_ATTEMPT_KILLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReduceSpeculativeTaskAttemptSucceedsEvenIfFirstIsKilled() {
|
public void testReduceSpeculativeTaskAttemptSucceedsEvenIfFirstIsKilled() {
|
||||||
mockTask = createMockTask(TaskType.REDUCE);
|
mockTask = createMockTask(TaskType.REDUCE);
|
||||||
runSpeculativeTaskAttemptSucceedsEvenIfFirstFails(TaskEventType.T_ATTEMPT_KILLED);
|
runSpeculativeTaskAttemptSucceeds(TaskEventType.T_ATTEMPT_KILLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMultipleTaskAttemptsSucceed() {
|
||||||
|
mockTask = createMockTask(TaskType.MAP);
|
||||||
|
runSpeculativeTaskAttemptSucceeds(TaskEventType.T_ATTEMPT_SUCCEEDED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCommitAfterSucceeds() {
|
||||||
|
mockTask = createMockTask(TaskType.REDUCE);
|
||||||
|
runSpeculativeTaskAttemptSucceeds(TaskEventType.T_ATTEMPT_COMMIT_PENDING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue