hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Poon (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-18026) ProtobufUtil seems to do extra array copying
Date Fri, 12 May 2017 19:05:09 GMT

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

Vincent Poon commented on HBASE-18026:
--------------------------------------

[~anoop.hbase] Could you clarify your concern?  Before, toByteArray() was copying from offset
0 up to the entire length of the proto ByteString array.  So how do we "loose the offset and
length of this row bytes" ?

One concern I think you might be raising is that Get constructor, unlike KeyValue/Put/Delete/Increment
constructors, doesn't do a copy of the passed in byte[] but just assigns it to a field.  I
think that might be a legitimate concern, although then the question becomes, if the row in
Get can be modified (and I don't know why we'd be doing an in-place modification?), why don't
we do a protective copy in the constructor instead like in Put, etc?

For the others though, it seems the code was copying twice.

> 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)

Mime
View raw message