Issue Details (XML | Word | Printable)

Key: HADOOP-1480
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Arun C Murthy
Reporter: Owen O'Malley
Votes: 0
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

pipes should be able to set user counters

Created: 08/Jun/07 10:53 PM   Updated: 08/Jul/09 04:41 PM
Return to search
Component/s: None
Affects Version/s: 0.14.0
Fix Version/s: 0.19.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works HADOOP-1480_0_20080723.patch 2008-07-23 08:58 AM Arun C Murthy 13 kB
Text File Licensed for inclusion in ASF works HADOOP-1480_1_20080811.patch 2008-08-12 06:34 AM Arun C Murthy 12 kB
Text File Licensed for inclusion in ASF works HADOOP-1480_2_20080812.patch 2008-08-13 07:08 AM Arun C Murthy 18 kB
Issue Links:
Blocker
 

Hadoop Flags: Reviewed
Resolution Date: 18/Aug/08 11:17 PM


 Description  « Hide
Pipes should expose the user defined counters.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Arun C Murthy added a comment - 21/Jul/08 06:02 PM
Here is a proposal after discussions with Owen:

Implement a Counter class to the C++ layer in Pipes:

Counter.cpp
class Counter {
  private:
    int id;
  public:
    void increment(long increment);
    static Counter getCounter(std::string group, std::string name);
}

The 'getCounter' contacts the Java Pipes' Mapper/Reducer and registers the given counter (group/name). The registration goes ahead and issues an 'id' which is stored inside the C++ Counter and is then used for incrementing the value of the counter.

Of course we'd need the getCounter/increment api in UpwardProtocol too...

UpwardProtocol.java
interface UpwardProtocol {

  // ...
  // ...
  // ...

  /**
   * Register a counter with the given group and name.
   * @param group counter group
   * @param name counter name
   * @return the id for the registered counter.
   * @throws IOException
   */
  int getCounter(String group, String name) throws IOException;
  
  /**
   * Increment the value of a registered counter.
   * @param id counter id of the registered counter
   * @param amount increment for the counter value
   * @throws IOException
   */
  void incrCounter(int id, long amount) throws IOException;

}

We'd need to add a Counters.Counter getCounter(String group, String name) api to Reporter to facilitate the above registration protocol:

Reporter.java
/**
   * Get the {@link Counter} of the given group with the given name.
   * 
   * @param group counter group
   * @param name counter name
   * @return the <code>Counter</code> of the given group/name.
   */
  public abstract Counter getCounter(String group, String name);

Arun C Murthy added a comment - 23/Jul/08 08:58 AM
Preliminary patch, mostly done - couple of minor loopholes. Testing...

Arun C Murthy added a comment - 12/Aug/08 06:34 AM
Updated, simpler patch. Needs more testing and maybe test-cases...

Arun C Murthy added a comment - 13/Aug/08 07:08 AM
Updated patch with test cases...

Owen O'Malley added a comment - 18/Aug/08 11:17 PM
I just committed this. Thanks, Arun!

Hudson added a comment - 22/Aug/08 12:34 PM