[
https://issues.apache.org/jira/browse/HBASE-16502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15438643#comment-15438643
]
Hiroshi Ikeda commented on HBASE-16502:
---------------------------------------
It seems ensureSpaceForTags is called before copying something to tagsBuffer.
It is better to initialize tagsBuffer with the empty byte array
(HConstants.EMPTY_BYTE_ARRAY) and update it in ensureSpaceForTags if any.
Moreover the while-loop in ensureSpaceForTags seems a little ridiculous, and it
is better to use Integer.highestOneBit or numberOfLeadingZeros. Concretely, for
example,
{code}
int newTagsBufferLength = Integer.highestOneBit(
Math.max(INITIAL_KEY_BUFFER_SIZE, tagsLength) - 1) << 1;
{code}
The same thing can be said for keyBuffer.
> Reduce garbage in BufferedDataBlockEncoder
> ------------------------------------------
>
> Key: HBASE-16502
> URL: https://issues.apache.org/jira/browse/HBASE-16502
> Project: HBase
> Issue Type: Improvement
> Reporter: binlijin
> Assignee: binlijin
> Fix For: 2.0.0, 1.4.0
>
> Attachments: HBASE-16502-master.patch, HBASE-16502-master_v2.patch,
> HBASE-16502.branch-1.v1.patch
>
>
> In BufferedDataBlockEncoder.SeekerState every read will new a tagsBuffer for
> compressTags. There is no need when no tags or compressTags=false, so we can
> reduce this new byte[] to reduce garbage.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)