You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Andrew Kyle Purtell (Jira)" <ji...@apache.org> on 2022/06/17 18:50:00 UTC

[jira] [Resolved] (HBASE-12827) set rowOffsetPerColumnFamily on ClientSmallScanner if lastResult is not null.

     [ https://issues.apache.org/jira/browse/HBASE-12827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Kyle Purtell resolved HBASE-12827.
-----------------------------------------
    Resolution: Abandoned

> set rowOffsetPerColumnFamily on ClientSmallScanner if lastResult is not null.
> -----------------------------------------------------------------------------
>
>                 Key: HBASE-12827
>                 URL: https://issues.apache.org/jira/browse/HBASE-12827
>             Project: HBase
>          Issue Type: Bug
>          Components: Client, Scanners
>            Reporter: Toshimasa NASU
>            Priority: Major
>         Attachments: HBASE-12827-v1.patch
>
>
> When you use the ClientSmallScanner, same Result has been acquired. And will be infinite loop.
> Cause to occur if you iterations beyond the (batch size * caching size) of Scan.
> Solution I think would be to correctly set the rowOffsetPerColumnFamily.
> I can be resolved by the following patch work.
> https://github.com/toshimasa-nasu/hbase/commit/2c35914624d3494c79114926d35fc886c9a235ec
> {code}
>    // When fetching results from server, skip the first result if it has the same
>    // row with this one
>    private byte[] skipRowOfFirstResult = null;
> +  private boolean alreadyGetRowOfFirstResult = false;
> +  private int nextRowOffsetPerColumnFamily = 0;
>  
>    /**
>     * Create a new ClientSmallScanner for the specified table. An HConnection
>  @@ -142,10 +144,19 @@ private boolean nextScanner(int nbRows, final boolean done,
>          LOG.debug("Finished with region " + this.currentRegion);
>        }
>      } else if (this.lastResult != null) {
> +      if (alreadyGetRowOfFirstResult) {
> +        nextRowOffsetPerColumnFamily += (this.scan.getBatch() * this.caching);
> +      } else {
> +        nextRowOffsetPerColumnFamily = (this.scan.getBatch() * (this.caching - 1));
> +      }
> +      this.scan.setRowOffsetPerColumnFamily(nextRowOffsetPerColumnFamily);
> +      alreadyGetRowOfFirstResult = true;
>        localStartKey = this.lastResult.getRow();
>        skipRowOfFirstResult = this.lastResult.getRow();
>        cacheNum++;
>      } else {
> +      alreadyGetRowOfFirstResult = false;
> +      nextRowOffsetPerColumnFamily = 0;
>        localStartKey = this.scan.getStartRow();
>      }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)