Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase >> mail # user >> Coprocessors and Zookeeper sessions

Aaron Tokhy 2012-12-14, 23:54
Copy link to this message
Re: Coprocessors and Zookeeper sessions
You didn't say which HBase version. I'm assuming 0.94.

When registered on a region, your endpoint will get an environment as
RegionCoprocessorEnvironment. See in
o.a.h.h.coprocessor.MultiRowMutationEndpoint an example of how an endpoint
can get the region coprocessor environment, like so:

    RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment)

You can the get to ZooKeeper via:

   ZooKeeperWatcher watcher = env.getRegionServerServices().getZooKeeper();
   RecoverableZooKeeper zk = watcher.getRecoverableZooKeeper();
   ZooKeeper rawZK = zk.getZooKeeper();

Or thereabouts, pardon any typos. The 'zk' object gives you the ZK API with
HBase's enhancements for retrying idempotent operations. The 'rawZK' object
is the unadorned ZK ZooKeeper instance.
On Fri, Dec 14, 2012 at 3:54 PM, Aaron Tokhy <[EMAIL PROTECTED]>wrote:

> Hello HBase users,
> I would like to store some shared state on every coprocessor invocation
> (throwing away the values when the coprocessor is finished running).  Is
> there a way to grab a handle of the regionserver's zookeeper session
> through a endpoint based coprocessor to rely on the said state?  I just
> want to store 2 atomic long values used by the coprocessors to tell them to
> finish running.
> -Thanks
> Aaron Tokhy
Best regards,

   - Andy

Problems worthy of attack prove their worth by hitting back. - Piet Hein
(via Tom White)
Aaron Tokhy 2012-12-17, 16:23
Andrew Purtell 2012-12-17, 19:06