From e3afdf5aa9463838bec3b7d3b170c9d456c93524 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Eagles Date: Tue, 19 Feb 2013 23:42:40 +0000 Subject: [PATCH] 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 --- hadoop-mapreduce-project/CHANGES.txt | 4 ++++ .../mapreduce/v2/app/job/impl/TaskImpl.java | 3 +++ .../v2/app/job/impl/TestTaskImpl.java | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 9af7d37d9d8..c3789f3458b 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -574,6 +574,10 @@ Release 0.23.7 - UNRELEASED MAPREDUCE-4992. AM hangs in RecoveryService when recovering tasks with 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 INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskImpl.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskImpl.java index c45197e1579..f0e120421b1 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskImpl.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskImpl.java @@ -857,6 +857,9 @@ public abstract class TaskImpl implements Task, EventHandler { if (task.successfulAttempt == null) { task.addAndScheduleAttempt(Avataar.VIRGIN); } + if ((task.commitAttempt != null) && (task.commitAttempt == taskAttemptId)) { + task.commitAttempt = null; + } } } diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskImpl.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskImpl.java index 3f03dc3fd32..d3297b3fb6b 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskImpl.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskImpl.java @@ -491,7 +491,25 @@ public class TestTaskImpl { 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 public void testFailureDuringTaskAttemptCommit() { mockTask = createMockTask(TaskType.MAP);