You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Paramesh Nc <pa...@gmail.com> on 2016/12/06 18:07:49 UTC

What is the correct way to get the HBase table using the end point co-processor?

Hi All,
What is the correct way to get the HBase table using the end point
co-processor?

I am using the endpoint coprocessor in HBase for fetching the records .

And here is the code Snippet of how I am getting the internal Scanner

InternalScanner internalScanner =
regionCoprocessorEnv.getRegion().getScanner(scan); List<Cell> results2 =
new ArrayList<Cell>(); boolean hasMore = false; do { if (internalScanner !=
null) hasMore = internalScanner.next(results2); String instance = null; for
(Cell cell : results2) { instance = Bytes
.toString(Bytes.copy(cell.getRowArray(), cell.getRowOffset(),
cell.getRowLength())); } }while (hasMore);

The Question is : Is it the right way to get the Intrnal Scanner ? If so ,

The next Question is why even the simple request to this coprocessor is
loading all regions present on all the Region Servers to process it though
the data I am fetching is not distributed on all over the regions present
as it is the call for the recent data.

And Please suggest me the way to solve this problem . The main issue is it
is simply scanning all the regions so the over all time taken is increasing
.

Thanks in Advance ,

Param.

Re: What is the correct way to get the HBase table using the end point co-processor?

Posted by Ted Yu <yu...@gmail.com>.
Please take a look at:
hbase-endpoint/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java

Can you tell us more about how the scan object is formed (I assume you have
set start / stop rows) ?

Cheers

On Tue, Dec 6, 2016 at 10:07 AM, Paramesh Nc <pa...@gmail.com> wrote:

> Hi All,
> What is the correct way to get the HBase table using the end point
> co-processor?
>
> I am using the endpoint coprocessor in HBase for fetching the records .
>
> And here is the code Snippet of how I am getting the internal Scanner
>
> InternalScanner internalScanner =
> regionCoprocessorEnv.getRegion().getScanner(scan); List<Cell> results2 =
> new ArrayList<Cell>(); boolean hasMore = false; do { if (internalScanner !=
> null) hasMore = internalScanner.next(results2); String instance = null;
> for
> (Cell cell : results2) { instance = Bytes
> .toString(Bytes.copy(cell.getRowArray(), cell.getRowOffset(),
> cell.getRowLength())); } }while (hasMore);
>
> The Question is : Is it the right way to get the Intrnal Scanner ? If so ,
>
> The next Question is why even the simple request to this coprocessor is
> loading all regions present on all the Region Servers to process it though
> the data I am fetching is not distributed on all over the regions present
> as it is the call for the recent data.
>
> And Please suggest me the way to solve this problem . The main issue is it
> is simply scanning all the regions so the over all time taken is increasing
> .
>
> Thanks in Advance ,
>
> Param.
>