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

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

Came to this area of code and this patch while working on off heap write path 
PoC.
{code}
 if (cell instanceof ByteBufferedCell) {
890           out.writeShort(rowLen);
891           ByteBufferUtils.copyBufferToStream(out, ((ByteBufferedCell) 
cell).getRowByteBuffer(),
892             ((ByteBufferedCell) cell).getRowPosition(), rowLen);
893           out.writeByte(fLen);
894           ByteBufferUtils.copyBufferToStream(out, ((ByteBufferedCell) 
cell).getFamilyByteBuffer(),
895             ((ByteBufferedCell) cell).getFamilyPosition(), fLen);
896           ByteBufferUtils.copyBufferToStream(out, ((ByteBufferedCell) 
cell).getQualifierByteBuffer(),
897             ((ByteBufferedCell) cell).getQualifierPosition(), qLen);
{code}
We have done this but it is not really helping us!  
In ByteBufferUtils#copyBufferToStream
{code}
public static void copyBufferToStream(OutputStream out, ByteBuffer in,
      int offset, int length) throws IOException {
    if (in.hasArray()) {
      out.write(in.array(), in.arrayOffset() + offset,
          length);
    } else {
      for (int i = 0; i < length; ++i) {
        out.write(toByte(in, offset + i));
      }
    }
  }
  {code}
So for DBB it is so costly op writing byte by byte reading each to on heap.
Even if we use writeByteBuffer(OutputStream out, ByteBuffer b, int offset, int 
length), it won't help us as the underlying stream is a ByteArrayOutputStream 
and so we will end up in copying.


> Ensure write paths work with ByteBufferedCells in case of compaction
> --------------------------------------------------------------------
>
>                 Key: HBASE-14832
>                 URL: https://issues.apache.org/jira/browse/HBASE-14832
>             Project: HBase
>          Issue Type: Sub-task
>          Components: regionserver, Scanners
>    Affects Versions: 2.0.0
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: HBASE-14832.patch, HBASE-14832_1.patch
>
>
> Currently any cell coming out of offheap Bucketcache while compaction does a 
> copy using the getXXXArray() API since write path does not work with BBCells. 
> This JIRA is aimed at changing the write path to support BBCells so that this 
> copy is avoided.



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

Reply via email to