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

Karan Mehta commented on HBASE-18000:
-------------------------------------

[~Apache9] 
This is a corner case. I feel that the bug is not fully resolved.

We have set the {{scannerId}} on the {{ScanResponse}} builder
{code}
      if (request.hasScannerId()) {
        rsh = getRegionScanner(request);
        isSmallScan = false;
        // The downstream projects such as AsyncHBase in OpenTSDB need this 
value. See HBASE-18000
        // for more details.
        builder.setScannerId(request.getScannerId());
      } else {
{code}

and {{rsh = getRegionScanner(request);}} look like this
{code}
      if (request.hasCloseScanner() && request.getCloseScanner()) {
        throw SCANNER_ALREADY_CLOSED;
      } else {
{code}

which implies that for a {{CloseScannerRequest}} an exception is thrown by this 
line. Thus, {{builder.setScannerId(request.getScannerId())}} is never executed. 
We thus send an empty {{ScanResponse}} for handling it as follows.
{code}
      if (e == SCANNER_ALREADY_CLOSED) {
        // Now we will close scanner automatically if there are no more results 
for this region but
        // the old client will still send a close request to us. Just ignore it 
and return.
        return builder.build();
      }
{code}
Thus there is no {{scannerId}} added in the {{builder}}.

A simple possible fix is to do this. Please suggest. 
{code}
       if (request.hasScannerId()) {
-        rsh = getRegionScanner(request);
-        isSmallScan = false;
         // The downstream projects such as AsyncHBase in OpenTSDB need this 
value. See HBASE-18000
         // for more details.
         builder.setScannerId(request.getScannerId());
+        rsh = getRegionScanner(request);
+        isSmallScan = false;
       } else {
{code}

> Make sure we always return the scanner id with ScanResponse
> -----------------------------------------------------------
>
>                 Key: HBASE-18000
>                 URL: https://issues.apache.org/jira/browse/HBASE-18000
>             Project: HBase
>          Issue Type: Bug
>          Components: regionserver
>    Affects Versions: 2.0.0, 1.4.0, 1.3.1
>            Reporter: Lars Hofhansl
>            Assignee: Duo Zhang
>             Fix For: 2.0.0, 1.4.0, 1.3.2
>
>         Attachments: HBASE-18000.patch
>
>
> Some external tooling (like OpenTSDB) relies on the scanner id to tie 
> asynchronous responses back to their requests.
> (see comments on HBASE-17489)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to