From c8f35bc3d285816a91e37be0d953a9a788c491a5 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Eagles Date: Tue, 19 Feb 2013 23:35:56 +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/trunk@1447965 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 99eea887039..06c755488f3 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -723,6 +723,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);