From 7d2466c0c8d11e7ccd27acd3b85df08862e9ed3e Mon Sep 17 00:00:00 2001 From: Robert Joseph Evans Date: Thu, 19 Apr 2012 20:23:47 +0000 Subject: [PATCH] MAPREDUCE-4129. Lots of unneeded counters log messages (Ahmed Radwan via bobby) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1328106 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../mapreduce/counters/AbstractCounters.java | 23 +++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index a5c3e7136f..f24ec88669 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -379,6 +379,9 @@ Release 0.23.3 - UNRELEASED MAPREDUCE-4165. Committing is misspelled as commiting in task logs (John Eagles via bobby) + MAPREDUCE-4129. Lots of unneeded counters log messages (Ahmed Radwan via + bobby) + Release 0.23.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/AbstractCounters.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/AbstractCounters.java index 768f1c782e..82ab06d7bf 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/AbstractCounters.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/counters/AbstractCounters.java @@ -201,7 +201,15 @@ public Iterator iterator() { * @return the group */ public synchronized G getGroup(String groupName) { - String newGroupName = filterGroupName(groupName); + + // filterGroupName + boolean groupNameInLegacyMap = true; + String newGroupName = legacyMap.get(groupName); + if (newGroupName == null) { + groupNameInLegacyMap = false; + newGroupName = Limits.filterGroupName(groupName); + } + boolean isFGroup = isFrameworkGroup(newGroupName); G group = isFGroup ? fgroups.get(newGroupName) : groups.get(newGroupName); if (group == null) { @@ -212,19 +220,14 @@ public synchronized G getGroup(String groupName) { limits.checkGroups(groups.size() + 1); groups.put(newGroupName, group); } + if (groupNameInLegacyMap) { + LOG.warn("Group " + groupName + " is deprecated. Use " + newGroupName + + " instead"); + } } return group; } - private String filterGroupName(String oldName) { - String newName = legacyMap.get(oldName); - if (newName == null) { - return Limits.filterGroupName(oldName); - } - LOG.warn("Group "+ oldName +" is deprecated. Use "+ newName +" instead"); - return newName; - } - /** * Returns the total number of counters, by summing the number of counters * in each group.