hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Yu (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HBASE-12827) set rowOffsetPerColumnFamily on ClientSmallScanner if lastResult is not null.
Date Fri, 26 Jun 2015 19:45:05 GMT

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

Ted Yu updated HBASE-12827:
---------------------------
    Status: Open  (was: Patch Available)

> 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)

Mime
View raw message