From 3e8c273f3721416f84fb530a0d73ab8442a5c025 Mon Sep 17 00:00:00 2001 From: Robert Joseph Evans Date: Fri, 16 Mar 2012 14:39:01 +0000 Subject: [PATCH] MAPREDUCE-4010. TestWritableJobConf fails on trunk (tucu via bobby) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1301551 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/hadoop/conf/Configuration.java | 2 +- hadoop-mapreduce-project/CHANGES.txt | 2 ++ .../apache/hadoop/mapred/TestWritableJobConf.java | 15 ++++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java index 3d8c3a5d45..25be131819 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java @@ -303,7 +303,7 @@ public synchronized static void addDeprecation(String key, String[] newKeys) { * @return true if the key is deprecated and * false otherwise. */ - private static boolean isDeprecated(String key) { + public static boolean isDeprecated(String key) { return deprecatedKeyMap.containsKey(key); } diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 585bdec67a..fc7a46f556 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -158,6 +158,8 @@ Release 0.23.3 - UNRELEASED MAPREDUCE-3431 NPE in Resource Manager shutdown. (stevel) + MAPREDUCE-4010. TestWritableJobConf fails on trunk (tucu via bobby) + Release 0.23.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestWritableJobConf.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestWritableJobConf.java index c3996b2f4a..2c0cedcbb3 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestWritableJobConf.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestWritableJobConf.java @@ -57,20 +57,25 @@ private K serDeser(K conf) throws Exception { } private void assertEquals(Configuration conf1, Configuration conf2) { - assertEquals(conf1.size(), conf2.size()); - + // We ignore deprecated keys because after deserializing, both the + // deprecated and the non-deprecated versions of a config are set. + // This is consistent with both the set and the get methods. Iterator> iterator1 = conf1.iterator(); Map map1 = new HashMap(); while (iterator1.hasNext()) { Map.Entry entry = iterator1.next(); - map1.put(entry.getKey(), entry.getValue()); + if (!Configuration.isDeprecated(entry.getKey())) { + map1.put(entry.getKey(), entry.getValue()); + } } - Iterator> iterator2 = conf1.iterator(); + Iterator> iterator2 = conf2.iterator(); Map map2 = new HashMap(); while (iterator2.hasNext()) { Map.Entry entry = iterator2.next(); - map2.put(entry.getKey(), entry.getValue()); + if (!Configuration.isDeprecated(entry.getKey())) { + map2.put(entry.getKey(), entry.getValue()); + } } assertEquals(map1, map2);