[
https://issues.apache.org/jira/browse/HBASE-12827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14270573#comment-14270573
]
chunhui shen commented on HBASE-12827:
--------------------------------------
ClientSmallScanner may return unexpected result if scan setting batch.(The same
row data may happen in multiple Result objects if scan.getBatch > 0, but
ClientSmallScanner consider different Results have different rows)
The above patch also couldn't fix this problem since it only fix the case where
the scan results all belongs to one Row.
A easy solution is using ClientScanner rather than ClientSmallScanner if
scan.getBatch > 0.
> 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, hbase, Scanners
> Reporter: Toshimasa NASU
> 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
(v6.3.4#6332)