MAPREDUCE-5009. Killing the Task Attempt slated for commit does not clear the value from the Task commitAttempt member (Robert Parker via jeagles)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1447969 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Turner Eagles 2013-02-19 23:42:40 +00:00
parent 270ecc1b98
commit e3afdf5aa9
3 changed files with 25 additions and 0 deletions

View File

@ -574,6 +574,10 @@ Release 0.23.7 - UNRELEASED
MAPREDUCE-4992. AM hangs in RecoveryService when recovering tasks with MAPREDUCE-4992. AM hangs in RecoveryService when recovering tasks with
speculative attempts (Robert Parker via jlowe) speculative attempts (Robert Parker via jlowe)
MAPREDUCE-5009. Killing the Task Attempt slated for commit does not clear
the value from the Task commitAttempt member (Robert Parker via jeagles)
Release 0.23.6 - UNRELEASED Release 0.23.6 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -857,6 +857,9 @@ public abstract class TaskImpl implements Task, EventHandler<TaskEvent> {
if (task.successfulAttempt == null) { if (task.successfulAttempt == null) {
task.addAndScheduleAttempt(Avataar.VIRGIN); task.addAndScheduleAttempt(Avataar.VIRGIN);
} }
if ((task.commitAttempt != null) && (task.commitAttempt == taskAttemptId)) {
task.commitAttempt = null;
}
} }
} }

View File

@ -491,7 +491,25 @@ public class TestTaskImpl {
assert(mockTask.getProgress() == progress); assert(mockTask.getProgress() == progress);
} }
@Test
public void testKillDuringTaskAttemptCommit() {
mockTask = createMockTask(TaskType.REDUCE);
TaskId taskId = getNewTaskID();
scheduleTaskAttempt(taskId);
launchTaskAttempt(getLastAttempt().getAttemptId());
updateLastAttemptState(TaskAttemptState.COMMIT_PENDING);
commitTaskAttempt(getLastAttempt().getAttemptId());
TaskAttemptId commitAttempt = getLastAttempt().getAttemptId();
updateLastAttemptState(TaskAttemptState.KILLED);
killRunningTaskAttempt(commitAttempt);
assertFalse(mockTask.canCommit(commitAttempt));
}
@Test @Test
public void testFailureDuringTaskAttemptCommit() { public void testFailureDuringTaskAttemptCommit() {
mockTask = createMockTask(TaskType.MAP); mockTask = createMockTask(TaskType.MAP);