From 58f40d3bf4b136fc7cbab3614a668ebb8b10f44b Mon Sep 17 00:00:00 2001 From: Arun Murthy Date: Fri, 27 Sep 2013 19:08:28 +0000 Subject: [PATCH] MAPREDUCE-5531. Fix compat with hadoop-1 in mapreduce.(TaskID, TaskAttemptID) by re-introducing missing constructors. Contributed by Robert Kanter. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1527033 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 4 ++++ .../hadoop/mapreduce/TaskAttemptID.java | 14 +++++++++++ .../org/apache/hadoop/mapreduce/TaskID.java | 23 +++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index cf29dabfb0f..5f750d81334 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -234,6 +234,10 @@ Release 2.1.2 - UNRELEASED MAPREDUCE-5513. ConcurrentModificationException in JobControl (Robert Parker via jlowe) + MAPREDUCE-5531. Fix compat with hadoop-1 in mapreduce.(TaskID, + TaskAttemptID) by re-introducing missing constructors. (Robert Kanter via + acmurthy) + Release 2.1.1-beta - 2013-09-23 INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskAttemptID.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskAttemptID.java index f2467f02a3b..45fd425fba2 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskAttemptID.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskAttemptID.java @@ -76,6 +76,20 @@ public class TaskAttemptID extends org.apache.hadoop.mapred.ID { int taskId, int id) { this(new TaskID(jtIdentifier, jobId, type, taskId), id); } + + /** + * Constructs a TaskId object from given parts. + * @param jtIdentifier jobTracker identifier + * @param jobId job number + * @param isMap whether the tip is a map + * @param taskId taskId number + * @param id the task attempt number + */ + @Deprecated + public TaskAttemptID(String jtIdentifier, int jobId, boolean isMap, + int taskId, int id) { + this(new TaskID(jtIdentifier, jobId, isMap, taskId), id); + } public TaskAttemptID() { taskId = new TaskID(); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskID.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskID.java index 3dc2babcbe6..488ffcc62e4 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskID.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskID.java @@ -91,6 +91,29 @@ public class TaskID extends org.apache.hadoop.mapred.ID { public TaskID(String jtIdentifier, int jobId, TaskType type, int id) { this(new JobID(jtIdentifier, jobId), type, id); } + + /** + * Constructs a TaskID object from given {@link JobID}. + * @param jobId JobID that this tip belongs to + * @param isMap whether the tip is a map + * @param id the tip number + */ + @Deprecated + public TaskID(JobID jobId, boolean isMap, int id) { + this(jobId, isMap ? TaskType.MAP : TaskType.REDUCE, id); + } + + /** + * Constructs a TaskInProgressId object from given parts. + * @param jtIdentifier jobTracker identifier + * @param jobId job number + * @param isMap whether the tip is a map + * @param id the tip number + */ + @Deprecated + public TaskID(String jtIdentifier, int jobId, boolean isMap, int id) { + this(new JobID(jtIdentifier, jobId), isMap, id); + } public TaskID() { jobId = new JobID();