You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by yonghu <yo...@gmail.com> on 2012/04/10 11:30:36 UTC

A confusion of RegionCoprocessorEnvironment.getReion() method

Hello,

The description of this method is " /** @return the region associated
with this coprocessor */" and the return value is an HRegion instance.
If I configure the region-coprocessor class in hbase-site.xml.  It
means that this coprocessor will be applied to every HRegion which
resides on this Region Server (if I understand right).  Why this
method only return one HRgion instance not a list of HRgion
instances?Suppose that a region server has two HRegions, one is for
table 'test1', the other is for table 'test2'.  Which HRgion instance
will be returned if I call RegionCoprocessorEnvironment.getReion()?

Thanks!

Yong

Re: A confusion of RegionCoprocessorEnvironment.getReion() method

Posted by yonghu <yo...@gmail.com>.
Thanks for your explanation. Now it's clear for me.

Regards!

Yong

On Tue, Apr 10, 2012 at 6:13 PM, Gary Helmling <gh...@gmail.com> wrote:
> Each and every HRegion on a given region server will have it's own
> distinct instance of your configured RegionObserver class.
> RegionCoprocessorEnvironment.getRegion() returns a reference to the
> HRegion containing the current coprocessor instance.
>
> The hierarchy is essentially:
>
> HRegionServer
> \_  HRegion
>        \_ RegionCoprocessorHost
>             \_  <your RegionObserver instance>
>
> (repeated for each HRegion).
>
> This blog post by Mingjie may help explain things a bit more:
> https://blogs.apache.org/hbase/entry/coprocessor_introduction
>
>
> --gh
>
>
>
> On Tue, Apr 10, 2012 at 2:30 AM, yonghu <yo...@gmail.com> wrote:
>> Hello,
>>
>> The description of this method is " /** @return the region associated
>> with this coprocessor */" and the return value is an HRegion instance.
>> If I configure the region-coprocessor class in hbase-site.xml.  It
>> means that this coprocessor will be applied to every HRegion which
>> resides on this Region Server (if I understand right).  Why this
>> method only return one HRgion instance not a list of HRgion
>> instances?Suppose that a region server has two HRegions, one is for
>> table 'test1', the other is for table 'test2'.  Which HRgion instance
>> will be returned if I call RegionCoprocessorEnvironment.getReion()?
>>
>> Thanks!
>>
>> Yong

Re: A confusion of RegionCoprocessorEnvironment.getReion() method

Posted by Gary Helmling <gh...@gmail.com>.
Each and every HRegion on a given region server will have it's own
distinct instance of your configured RegionObserver class.
RegionCoprocessorEnvironment.getRegion() returns a reference to the
HRegion containing the current coprocessor instance.

The hierarchy is essentially:

HRegionServer
\_  HRegion
        \_ RegionCoprocessorHost
             \_  <your RegionObserver instance>

(repeated for each HRegion).

This blog post by Mingjie may help explain things a bit more:
https://blogs.apache.org/hbase/entry/coprocessor_introduction


--gh



On Tue, Apr 10, 2012 at 2:30 AM, yonghu <yo...@gmail.com> wrote:
> Hello,
>
> The description of this method is " /** @return the region associated
> with this coprocessor */" and the return value is an HRegion instance.
> If I configure the region-coprocessor class in hbase-site.xml.  It
> means that this coprocessor will be applied to every HRegion which
> resides on this Region Server (if I understand right).  Why this
> method only return one HRgion instance not a list of HRgion
> instances?Suppose that a region server has two HRegions, one is for
> table 'test1', the other is for table 'test2'.  Which HRgion instance
> will be returned if I call RegionCoprocessorEnvironment.getReion()?
>
> Thanks!
>
> Yong