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

Anoop Sam John commented on HBASE-14099:
----------------------------------------

{code}
|| compareLastKey(lastKeyKV, smallestScanRow) < 0;
return !nonOverLapping;
}

protected int compareLastKey(Cell lastKeyKV, byte[] scanRow) {
      int diff = getComparator().compareRows(lastKeyKV, scanRow, 0, 
scanRow.length);
      if (diff != 0) {
       return diff;
      }
      // if the rows does not match then atleast the family or qualifier will 
make the
      // lastKeyKV greater.  There should not be a need to compare the ts
      return 1;
    }

{code}

Do you really need this extra logic for the compare? Now we are only comparing 
the rks. Only when the smallestScanRow is greater than the lastKeyKV we have to 
set the boolean. Means when both are same (return of compare is 0) we dont want 
to set it. And that is what the simple compare op also will do.
So getComparator().compareRows(lastKeyKV, smallestScanRow, 0, 
smallestScanRow.length)<0; whould be enough

> StoreFile.passesKeyRangeFilter need not create Cells from the Scan's start 
> and stop Row
> ---------------------------------------------------------------------------------------
>
>                 Key: HBASE-14099
>                 URL: https://issues.apache.org/jira/browse/HBASE-14099
>             Project: HBase
>          Issue Type: Bug
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: HBASE-14099.patch
>
>
> During profiling saw that the code here in passesKeyRangeFilter in Storefile
> {code}
>   KeyValue smallestScanKeyValue = scan.isReversed() ? KeyValueUtil
>           .createFirstOnRow(scan.getStopRow()) : 
> KeyValueUtil.createFirstOnRow(scan
>           .getStartRow());
>       KeyValue largestScanKeyValue = scan.isReversed() ? KeyValueUtil
>           .createLastOnRow(scan.getStartRow()) : 
> KeyValueUtil.createLastOnRow(scan
>           .getStopRow());
> {code}
> This row need not be copied now considering that we have 
> CellComparator.compareRows(Cell, byte[]). 
> We have already refactored the firstKeyKv and lastKeyKV as part of other 
> JIRAs.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to