[
https://issues.apache.org/jira/browse/HBASE-12202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14173689#comment-14173689
]
ramkrishna.s.vasudevan commented on HBASE-12202:
------------------------------------------------
Had a look at the patch.
-> Now doing duplicate and a slice, we are doing more operations but they may
be minor I suppose.
-> ByteBufferUtils.copyFromBufferToBuffer() can we reuse the one above the new
one. I mean can we refactor both of them.
-> In HfileBlock.getBufferReadOnly()
{code}
- return ByteBuffer.wrap(buf.array(), buf.arrayOffset(),
- buf.limit() - totalChecksumBytes()).slice();
+ ByteBuffer dup = this.buf.duplicate();
+ dup.limit(buf.limit() - totalChecksumBytes());
+ return dup.slice();
{code}
This will impact the limit and the capacity of the returning array. Will that
be a concern? When we say a read only will it be better to return a real read
only Buffer? In case of BR we tried to do achieve that by returning an
ImmutableBR unless and otherwise stated to return a MutableBR.
{code}
ByteBuffer inDup = this.buf.duplicate();
+ inDup.limit(inDup.limit() + headerSize());
{code}
Why is the limit after considering the headerSize()?
> Support DirectByteBuffer usage in HFileBlock
> --------------------------------------------
>
> Key: HBASE-12202
> URL: https://issues.apache.org/jira/browse/HBASE-12202
> Project: HBase
> Issue Type: Sub-task
> Components: regionserver, Scanners
> Reporter: Anoop Sam John
> Assignee: Anoop Sam John
> Fix For: 2.0.0, 0.99.2
>
> Attachments: HBASE-12202.patch, HBASE-12202_V2.patch
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)