hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r806504 - in /hadoop/mapreduce/trunk: CHANGES.txt src/java/org/apache/hadoop/mapreduce/Counters.java src/test/mapred/org/apache/hadoop/mapreduce/TestMapReduceLocal.java
Date Fri, 21 Aug 2009 11:37:18 GMT
Author: sharad
Date: Fri Aug 21 11:37:18 2009
New Revision: 806504

URL: http://svn.apache.org/viewvc?rev=806504&view=rev
Log:
MAPREDUCE-818. Fixes Counters#getGroup API. Contributed by Amareshwari Sriramadasu.

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/Counters.java
    hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/TestMapReduceLocal.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=806504&r1=806503&r2=806504&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Fri Aug 21 11:37:18 2009
@@ -425,3 +425,6 @@
     memory management parameters are used in configuration.
     (Sreekanth Ramakrishnan via yhemanth)
 
+    MAPREDUCE-818. Fixes Counters#getGroup API. (Amareshwari Sriramadasu 
+    via sharad)
+

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/Counters.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/Counters.java?rev=806504&r1=806503&r2=806504&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/Counters.java (original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapreduce/Counters.java Fri Aug 21 11:37:18
2009
@@ -37,11 +37,7 @@
   }
 
   public Counter findCounter(String groupName, String counterName) {
-    CounterGroup grp = groups.get(groupName);
-    if (grp == null) {
-      grp = new CounterGroup(groupName);
-      groups.put(groupName, grp);
-    }
+    CounterGroup grp = getGroup(groupName);
     return grp.findCounter(counterName);
   }
 
@@ -78,7 +74,12 @@
    * with the specified name.
    */
   public synchronized CounterGroup getGroup(String groupName) {
-    return groups.get(groupName);
+    CounterGroup grp = groups.get(groupName);
+    if (grp == null) {
+      grp = new CounterGroup(groupName);
+      groups.put(groupName, grp);
+    }
+    return grp;
   }
 
   /**

Modified: hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/TestMapReduceLocal.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/TestMapReduceLocal.java?rev=806504&r1=806503&r2=806504&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/TestMapReduceLocal.java
(original)
+++ hadoop/mapreduce/trunk/src/test/mapred/org/apache/hadoop/mapreduce/TestMapReduceLocal.java
Fri Aug 21 11:37:18 2009
@@ -161,6 +161,9 @@
     assertEquals("map out = combine in", mapOut, combineIn);
     assertEquals("combine out = reduce in", combineOut, reduceIn);
     assertTrue("combine in > combine out", combineIn > combineOut);
+    String group = "Random Group";
+    CounterGroup ctrGrp = ctrs.getGroup(group);
+    assertEquals(0, ctrGrp.size());
   }
 
   public void runMultiFileWordCount(Configuration  conf) throws Exception  {



Mime
View raw message