|
Preliminary patch, mostly done - couple of minor loopholes. Testing...
Updated, simpler patch. Needs more testing and maybe test-cases...
Updated patch with test cases...
I just committed this. Thanks, Arun!
Integrated in Hadoop-trunk #581 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/581/
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Implement a Counter class to the C++ layer in Pipes:
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...
We'd need to add a Counters.Counter getCounter(String group, String name) api to Reporter to facilitate the above registration protocol:
/** * 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);