[ 
https://issues.apache.org/jira/browse/HBASE-3583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007744#comment-13007744
 ] 

Mingjie Lai commented on HBASE-3583:
------------------------------------

Stack. Need your feedback for your first comments: 
https://review.cloudera.org/r/1617/diff/1/?file=26436#file26436line1812


>>>>

My original purpose of this addition map is to have a way to obtain region name 
from scanner id, then get region instance, in order to call corresponding 
region coprocessors: 

Result[] next(final long scannerId, int nbRows) {
  // need to get to region to access coprocessors
  ... 
}

There are several options can do it:

1) add a map along with original scanners map (as the 1st patch)
2) as you suggested, to change the meaning/data type of scanner id, but it will 
impact other components, ie. client lib, etc. 
3) instead of Map<InternalScanner>, just use Map<HRegion.RegionScanner> as 
scanners. There are a lot of ugly thing like: 

if (scanner instanceof HRegion.RegionScanner) {
  ...
}

so why not just using HRegion.RegionScanner directly. 

4) ugly way: don't add anything, just use existing suff 

if (scanner instanceof HRegion.RegionScanner){ 
  ... 
  HRegionInfo regionName = rs.getRegionName(); ... 
}
<<<<

What do you think? 

> Coprocessors: RegionObserver: ScannerNext and ScannerClose hooks are called 
> when get() is invoked
> -------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-3583
>                 URL: https://issues.apache.org/jira/browse/HBASE-3583
>             Project: HBase
>          Issue Type: Bug
>          Components: coprocessors
>    Affects Versions: 0.92.0
>            Reporter: Mingjie Lai
>            Assignee: Mingjie Lai
>             Fix For: 0.92.0
>
>         Attachments: HBase3583.patch
>
>
> RegionObserver upcalls are expected to be triggered by corresponding client 
> calls. 
> I found that if a HTable.get() is issued, ScannerNext, and ScannerClose hooks 
> are also invoked. 
> Here is the reason: HRegion.get() is implemented with an internal scanner:
> {code}
>     InternalScanner scanner = null;
>     try {
>       scanner = getScanner(scan);
>       scanner.next(results);
>     } finally {
>       if (scanner != null)
>         scanner.close();
>     }
> {code}
> where scanner.next, and scanner.close() are implemented with RegionObserver 
> hooks. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to