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

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

IMO also getRowByteBuffer is better than getRow. 
We had getRow() returning byte[] in Cell. In trunk we removed it very recently.

So Stack, you agree to the idea of not throwing Exception when we call 
getXXXArray() on a DBB backed cell. So here we will copy and return the byte[].
Regarding getXXXOffset comment, u mean when the Cell is DBB backed, the user 
has to assume the offset to be 0 always?  That means again every where we have 
to have instance of BBCell check.

One more thing.  We will have to make a BBCell impl with backing on heap BB as 
well as off heap BB. This is the case of DBE.  So there we will compute the new 
Key by algo and it will be in a byte[].  The value part will be in an off heap 
BB.  We dont want to copy the value part.  So what we will do is  make a new 
Cell impl with key abd value backed by 2 diff data structure.  And so it has to 
be extending BBCell.   Our read path and comparators have check like if the 
incoming cell is BBCell, we will use getXXXByteBuffer APIs instead of 
getXXXArray.   So for the key parts on this cell also, we will use 
getXXXByteBuffer API.   If we are keeping the ref to key as byte[] type, every 
call to BB API has to wrap it and so make an Object.  So what we do is keep the 
ref to key part as BB only by wrapping the key byte[].    So we have a cell 
with on heap BB backed.    Here the cell is BBCell and when one use 
getFamilyArray(), he can not assume the offset to be 0.  This will be a non 
zero value.

Said all these to explain why we need 2 APIs for offset in byte[] and position 
in BB.  It can be different in many a cases and no assumptions also possible.

Regarding reduce the method name length, I think getXXXPosition() is just fine. 
 This class deals with BB APIs and so when we say position, it is in BB is 
understood.   Also the name offset suits with array and with BB the term 
'position' better fits. :-)

> Create the fake keys required in the scan path to avoid copy to byte[]
> ----------------------------------------------------------------------
>
>                 Key: HBASE-14398
>                 URL: https://issues.apache.org/jira/browse/HBASE-14398
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>             Fix For: 2.0.0
>
>         Attachments: HBASE-14398.patch, HBASE-14398_1.patch
>
>
> Already we have created some fake keys for the ByteBufferedCells so that we 
> can avoid the copy requried to create fake keys. This JIRA aims to fill up 
> all such places so that the Offheap BBs are not copied to onheap byte[].



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

Reply via email to