[
https://issues.apache.org/jira/browse/HBASE-18026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16007919#comment-16007919
]
Anoop Sam John commented on HBASE-18026:
----------------------------------------
{code}
byte[] row = zeroCopyGetBytes(proto.getRow());
373 Get get = new Get(row);
{code}
Not just with KV construction but in places like above also we have changes !
I feel this will be problematic. We avoid toByteArray. The zero copy op will
give a ref to the ByteString backing byte[] which is the array to which the
incoming RPC req was read. So we loose the offset and length of this row
bytes. Am I missing some thing?
> ProtobufUtil seems to do extra array copying
> --------------------------------------------
>
> Key: HBASE-18026
> URL: https://issues.apache.org/jira/browse/HBASE-18026
> Project: HBase
> Issue Type: Bug
> Affects Versions: 2.0.0, 1.3.2
> Reporter: Vincent Poon
> Assignee: Vincent Poon
> Priority: Minor
> Fix For: 2.0.0, 1.4.0, 1.2.6, 1.3.2, 1.1.11
>
> Attachments: HBASE-18026.branch-1.v1.patch,
> HBASE-18026.master.v1.patch
>
>
> In ProtobufUtil, the protobuf fields are copied into an array using
> toByteArray(). These are then passed into the KeyValue constructor which
> does another copy.
> It seems like we can avoid a copy here by using
> HBaseZeroCopyByteString#zeroCopyGetBytes() ?
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)