[
https://issues.apache.org/jira/browse/HBASE-15721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15308419#comment-15308419
]
Anoop Sam John commented on HBASE-15721:
----------------------------------------
Yes. Increasing the responsibility of the MSLAB from just an allocator to one
who manages that new area for this Cell. I felt this is ok. (?)
We need serialize to Stream and BB. As of in this patch, there might be byte[]
coming into picture. Once off heap MSLAB also in place, we will need BB. So
better now only we can stick with BB. This Streamable interface helps us to do
this serialize in one shot. Or else we will have to parse diff lengths and
write each of them and each of the cell part (like RK, CF etc) one after the
other. This was coming in Cell encoding in RPC side (To codec encoder).
While we are at MSLAB, we were doing the N step way of writing out a cell into
a new area.
> Optimization in cloning cells into MSLAB
> ----------------------------------------
>
> Key: HBASE-15721
> URL: https://issues.apache.org/jira/browse/HBASE-15721
> Project: HBase
> Issue Type: Sub-task
> Components: regionserver
> Reporter: Anoop Sam John
> Assignee: Anoop Sam John
> Fix For: 2.0.0
>
> Attachments: HBASE-15721.patch, HBASE-15721_V2.patch
>
>
> Before cells added to memstore CSLM, there is a clone of cell after copying
> it to MSLAB chunk area. This is done not in an efficient way.
> {code}
> public static int appendToByteArray(final Cell cell, final byte[] output,
> final int offset) {
> int pos = offset;
> pos = Bytes.putInt(output, pos, keyLength(cell));
> pos = Bytes.putInt(output, pos, cell.getValueLength());
> pos = appendKeyTo(cell, output, pos);
> pos = CellUtil.copyValueTo(cell, output, pos);
> if ((cell.getTagsLength() > 0)) {
> pos = Bytes.putAsShort(output, pos, cell.getTagsLength());
> pos = CellUtil.copyTagTo(cell, output, pos);
> }
> return pos;
> }
> {code}
> Copied in 9 steps and we end up parsing all lengths. When the cell
> implementation is backed by a single byte[] (Like KeyValue) this can be done
> in single step copy.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)