[
https://issues.apache.org/jira/browse/HBASE-21951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16828883#comment-16828883
]
Zheng Hu commented on HBASE-21951:
----------------------------------
Thinking about this issue again, yeah, we have two OutputStream:
1. ByteBufferOutputStream. this kind of os only maitains a single ByteBuffer
inside, if the desired size exceed the capacity, then it will extend to an
larger ByteBuffer and copy bytes from the previous ByteBuffer into the larger
one. Currently, we use this type to write some expected small byte[], such as
ConnectionHeader or SaslResponseHeader. Also the HBase client use this kind of
OS to write bytes because client is always on heap.
2. ByteBufferListOutputStream: this kind of OS maintains an ByteBuffer list
inside, and if the desired size exceed the capacity, then it will allocate an
new ByteBuffer and append to the ByteBufferList then continue read bytes to the
new ByteBuffer. It mainly used for write some larger bytes such as encoded
cells or something.
Indeed, the abstract ByteBuffOutputStream will simplify the logic, because we
can unify the ByteBufferOutputStream and ByteBufferListOutputStream into one.
while if we do that, then it will use the same logic same as
ByteBufferListOutputStream. then if writing some small bytes such as header or
something, the ByteBuffer memory will waste a lot. So I've changed my mind:
plan to keep the current two outputstream and resolve this issue as won't fix.
FYI, [~anoop.hbase].
> Abstract an ByteBuffOutputStream for building cell block
> --------------------------------------------------------
>
> Key: HBASE-21951
> URL: https://issues.apache.org/jira/browse/HBASE-21951
> Project: HBase
> Issue Type: Sub-task
> Reporter: Zheng Hu
> Assignee: Zheng Hu
> Priority: Major
> Attachments:
> 0001-HBASE-21951-Abstract-an-ByteBuffOutputStream-for-bui.patch
>
>
> Now we have an ByteBufferListOutputStream and an ByteBufferOutputStream,
> actually, After HBASE-21916, we can combine those two into an one
> ByteBuffOutputStream.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)