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

Vikas Vishwakarma commented on HBASE-20896:
-------------------------------------------

[~mdrob] the changes do not add any extra linkedlist operations. In the 
original code in ClientScanner.java 

we already have the cache LinkedList 

In ClientScanner.java  we call ScanResultCache.addAndGet(..)  which takes 
Result array values as input, does all the partial handling on it during which 
it gets converted to LinkedList or subarrays or goes through a separate 
iterations to update numRowCounts, etc depending on which handling gets invoked 
\{AllowPartialScanResultCache, BatchScanResultCache, CompleteScanResultCache} 
and returns a processed result array 

The returned result array from  ScanResultCache.addAndGet(..)  is again 
iterated over and added to the cache LinkedList back in ClientScanner
{code:java}
public abstract class ClientScanner extends AbstractClientScanner {
..
protected final LinkedList<Result> cache = new LinkedList<Result>();
..

  protected void loadCache() throws IOException {
...
Result[] resultsToAddToCache =
scanResultCache.addAndGet(values, callable.isHeartbeatMessage());
..
for (Result rs : resultsToAddToCache) {
cache.add(rs);
for (Cell cell : rs.rawCells()) {
remainingResultSize -= CellUtil.estimatedHeapSizeOf(cell);
}
countdown--;
this.lastResult = rs;
}
..
}{code}
 

In my changes I have only eliminated all the intermediate array iterations and 
conversions to list or subarray in \{AllowPartialScanResultCache, 
BatchScanResultCache, CompleteScanResultCache}. In this case Result array 
values is directly added to the cache depending on the various checks and 
conditions and the numRowCounts is updated along with it. So all the work is 
done in a single iteration over the values input passed to 
loadResultsToCache(..) . High level structure 
{code:java}
public abstract class ClientScanner extends AbstractClientScanner {
..
protected final LinkedList<Result> cache = new LinkedList<Result>();
..

  protected void loadCache() throws IOException {
..
scanResultCache.loadResultsToCache(values, callable.isHeartbeatMessage());
..
}

//add values to cache in loadResultsToCache itself in 
AllowPartialScanResultCache, BatchScanResultCache, CompleteScanResultCache 
after all the checks and partialResult handling

{code}
 

 

> Port HBASE-20866 to branch-1 and branch-1.4 
> --------------------------------------------
>
>                 Key: HBASE-20896
>                 URL: https://issues.apache.org/jira/browse/HBASE-20896
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Andrew Purtell
>            Assignee: Vikas Vishwakarma
>            Priority: Major
>             Fix For: 1.5.0, 1.4.7
>
>         Attachments: HBASE-20896.branch-1.4.001.patch, 
> HBASE-20896.branch-1.4.002.patch, HBASE-20896.branch-1.4.003.patch
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to