Browse Source

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
Robert Joseph Evans 13 years ago
parent
commit
7d2466c0c8

+ 3 - 0
hadoop-mapreduce-project/CHANGES.txt

@@ -379,6 +379,9 @@ Release 0.23.3 - UNRELEASED
     MAPREDUCE-4165. Committing is misspelled as commiting in task logs
     MAPREDUCE-4165. Committing is misspelled as commiting in task logs
     (John Eagles via bobby)
     (John Eagles via bobby)
 
 
+    MAPREDUCE-4129. Lots of unneeded counters log messages (Ahmed Radwan via
+    bobby)
+
 Release 0.23.2 - UNRELEASED
 Release 0.23.2 - UNRELEASED
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 13 - 10
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 abstract class AbstractCounters<C extends Counter,
    * @return the group
    * @return the group
    */
    */
   public synchronized G getGroup(String groupName) {
   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);
     boolean isFGroup = isFrameworkGroup(newGroupName);
     G group = isFGroup ? fgroups.get(newGroupName) : groups.get(newGroupName);
     G group = isFGroup ? fgroups.get(newGroupName) : groups.get(newGroupName);
     if (group == null) {
     if (group == null) {
@@ -212,19 +220,14 @@ public abstract class AbstractCounters<C extends Counter,
         limits.checkGroups(groups.size() + 1);
         limits.checkGroups(groups.size() + 1);
         groups.put(newGroupName, group);
         groups.put(newGroupName, group);
       }
       }
+      if (groupNameInLegacyMap) {
+        LOG.warn("Group " + groupName + " is deprecated. Use " + newGroupName
+            + " instead");
+      }
     }
     }
     return group;
     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
    * Returns the total number of counters, by summing the number of counters
    * in each group.
    * in each group.