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

ramkrishna.s.vasudevan updated HBASE-13939:
-------------------------------------------
    Attachment: HBASE-13939_3.patch

Updated patch for trunk. As the seekBefore() issue has been handled by 
HBASE-13945- this change can go in trunk alone. Changed getFirstKeyInBlock to 
getFirstKeyCellInBlock as the return type is changed.
This is particularly useful in case of Prefix tree where we already have the 
first cell in the form of a cell in Prefix tree where as in other cases we need 
to create one such cell from the BB. If we don do this, then in case of 
PrefixTree we have to copy from the cell which we already have to a BB.  In 
other DBE cases it is only a object creation.

> Make HFileReaderImpl.getFirstKeyInBlock() to return a Cell
> ----------------------------------------------------------
>
>                 Key: HBASE-13939
>                 URL: https://issues.apache.org/jira/browse/HBASE-13939
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>            Priority: Minor
>             Fix For: 2.0.0, 1.1.2
>
>         Attachments: HBASE-13939.patch, HBASE-13939_1.patch, 
> HBASE-13939_2.patch, HBASE-13939_3.patch, HBASE-13939_branch-1.1.patch
>
>
> The getFirstKeyInBlock() in HFileReaderImpl is returning a BB. It is getting 
> used in seekBefore cases.  Because we return a BB we create a KeyOnlyKV once 
> for comparison
> {code}
>       if (reader.getComparator()
>           .compareKeyIgnoresMvcc(
>               new KeyValue.KeyOnlyKeyValue(firstKey.array(), 
> firstKey.arrayOffset(),
>                   firstKey.limit()), key) >= 0) {
>         long previousBlockOffset = seekToBlock.getPrevBlockOffset();
>         // The key we are interested in
>         if (previousBlockOffset == -1) {
>           // we have a 'problem', the key we want is the first of the file.
>           return false;
>         }
> ........
> {code}
> And if the compare fails we again create another KeyOnlyKv 
> {code}
>       Cell firstKeyInCurrentBlock = new 
> KeyValue.KeyOnlyKeyValue(Bytes.getBytes(firstKey));
>       loadBlockAndSeekToKey(seekToBlock, firstKeyInCurrentBlock, true, key, 
> true);
> {code}
> So one object will be enough and that can be returned by getFirstKeyInBlock. 
> Also will be useful when we go with Buffered backed server cell to change in 
> one place. 



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

Reply via email to