You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Pavel Hančar <pa...@gmail.com> on 2013/05/03 12:34:12 UTC

Endpoint vs. Observer Coprocessors

Hello,
I've just started to discover coprocessors. Namely the classes
BaseEndpointCoprocessor and BaseRegionObserver. I need the postPut() method
and than some special user calls. So I need both, but I want to have my
data in one common variable. What's the easiest way to manage? Do I have to
Implement my own Base...Coprocessor class?
 Best wishes,
  Pavel Hančar

Re: Endpoint vs. Observer Coprocessors

Posted by Gary Helmling <gh...@gmail.com>.
A single class can act as both a RegionObserver and an endpoint.  The
Base... classes are just there for convenience.

To implement both, for example, you could:
1) have your class extend BaseRegionObserver, override postPut(), etc
2) define an interface that extends CoprocessorProtocol.  the methods you
define will be callable on the endpoint
3) have your same class from (1) implement your interface from (2)

Once the coprocessor is loaded, you should be able to call the interface
methods from (2) using HTable.coprocessorProxy() or
HTable.coprocessorExec().  This will fan out the method invocations on the
coprocessor instances loaded on the regions which contain the row key or
row key range you specify for the calls.


On Fri, May 3, 2013 at 5:55 AM, Pavel Hančar <pa...@gmail.com> wrote:

>  Hello,
> I'd like to have an object (index of vectors of pictures) in RAM of every
> regionserver. To have a variable of some Coprocessor class seems to be good
> way. I need to add a new vector to the index, when I add a picture to HBase
> (it's the postPut() method) and then I need to search trough the index by
> some special API, when users click in my web application. The second task
> seems to be good for some endpoint. But I need to share the variable with
> index.
>   Thanks for the answers.
>   Pavel
>
>
> 2013/5/3 Anoop John <an...@gmail.com>
>
> > >data in one common variable
> > Didn't follow u completely. Can u tell us little more on your usage. How
> > exactly the endpoint to be related with the CP hook (u said postPut)
> >
> > -Anoop-
> >
> >
> > On Fri, May 3, 2013 at 4:04 PM, Pavel Hančar <pa...@gmail.com>
> > wrote:
> >
> > > Hello,
> > > I've just started to discover coprocessors. Namely the classes
> > > BaseEndpointCoprocessor and BaseRegionObserver. I need the postPut()
> > method
> > > and than some special user calls. So I need both, but I want to have my
> > > data in one common variable. What's the easiest way to manage? Do I
> have
> > to
> > > Implement my own Base...Coprocessor class?
> > >  Best wishes,
> > >   Pavel Hančar
> > >
> >
>

Re: Endpoint vs. Observer Coprocessors

Posted by Pavel Hančar <pa...@gmail.com>.
 Hello,
I'd like to have an object (index of vectors of pictures) in RAM of every
regionserver. To have a variable of some Coprocessor class seems to be good
way. I need to add a new vector to the index, when I add a picture to HBase
(it's the postPut() method) and then I need to search trough the index by
some special API, when users click in my web application. The second task
seems to be good for some endpoint. But I need to share the variable with
index.
  Thanks for the answers.
  Pavel


2013/5/3 Anoop John <an...@gmail.com>

> >data in one common variable
> Didn't follow u completely. Can u tell us little more on your usage. How
> exactly the endpoint to be related with the CP hook (u said postPut)
>
> -Anoop-
>
>
> On Fri, May 3, 2013 at 4:04 PM, Pavel Hančar <pa...@gmail.com>
> wrote:
>
> > Hello,
> > I've just started to discover coprocessors. Namely the classes
> > BaseEndpointCoprocessor and BaseRegionObserver. I need the postPut()
> method
> > and than some special user calls. So I need both, but I want to have my
> > data in one common variable. What's the easiest way to manage? Do I have
> to
> > Implement my own Base...Coprocessor class?
> >  Best wishes,
> >   Pavel Hančar
> >
>

Re: Endpoint vs. Observer Coprocessors

Posted by Anoop John <an...@gmail.com>.
>data in one common variable
Didn't follow u completely. Can u tell us little more on your usage. How
exactly the endpoint to be related with the CP hook (u said postPut)

-Anoop-


On Fri, May 3, 2013 at 4:04 PM, Pavel Hančar <pa...@gmail.com> wrote:

> Hello,
> I've just started to discover coprocessors. Namely the classes
> BaseEndpointCoprocessor and BaseRegionObserver. I need the postPut() method
> and than some special user calls. So I need both, but I want to have my
> data in one common variable. What's the easiest way to manage? Do I have to
> Implement my own Base...Coprocessor class?
>  Best wishes,
>   Pavel Hančar
>