[
https://issues.apache.org/jira/browse/HBASE-17235?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ramkrishna.s.vasudevan updated HBASE-17235:
-------------------------------------------
Attachment: HBASE-17235.patch
Simple patch.
I think we could do the same for the ByteBuffInput also. Instead of exposing
the newInstance(ByteInput, boolean) in CIS we could just add a
UnsafeByteOperations#wrap(ByteInput, offset, len). And we could just call that
and do a #newcodedInput() over that. So internally we do return a immutable
version of the ByteInput only. This way we can avoid CIS#newInstance(ByteInput)
exposure and can keep it package private as done in COS. What others think
[~anoopsamjohn] and [[email protected]]?
> Minor improvement in creation of CIS for onheap buffer cases
> ------------------------------------------------------------
>
> Key: HBASE-17235
> URL: https://issues.apache.org/jira/browse/HBASE-17235
> Project: HBase
> Issue Type: Improvement
> Reporter: ramkrishna.s.vasudevan
> Assignee: ramkrishna.s.vasudevan
> Priority: Minor
> Attachments: HBASE-17235.patch
>
>
> {code}
> if (buf.hasArray()) {
> cis = CodedInputStream.newInstance(buf.array(), offset, buf.limit());
> } else {
> {code}
> Currently we do this for onheap buffers incase there is no reservoir or the
> size is less than the minSizeforReservoir. I could see that even if reservoir
> is there there are requests which goes with the above way of creating CIS.
> This could be made efficient to avoid underlying copies by just doing this
> {code}
> cis = UnsafeByteOperations.unsafeWrap(buf.array(), offset,
> buf.limit()).newCodedInput();
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)