hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-15721) Optimization in cloning cells into MSLAB
Date Mon, 02 May 2016 05:39:13 GMT

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

stack commented on HBASE-15721:
-------------------------------

We undeprecate the below:

1241	  @Deprecated		
1242	  public byte [] getBuffer() {

So, I can ask to get a byte [] on a KeyValue? Any KeyValue? Ain't you working hard to get
rid of these?

This is odd to add to Streamable Interface:

{code}
48	  /**
49	   * Serialize this cell to the given array at specified position
50	   * @param buf array where to write
51	   * @param offset Offset within buf where to write
52	   */
53	  void write(byte[] buf, int offset);
{code}

The Interface says "This marks a Cell as streamable to a given OutputStream."

In the above, we are not 'streaming' to an OutputStream, we are writing a byte array.

Then this ripples throughout our base types.

Ditto on MemStoreLAB. It is about allocating bytes but then we add...

   * Clone the cell content to this MSLAB allocated memory area and create a new Cell around
that.
43	   * When it is not able to get enough space to clone this cell to, it returns null
46	   */		
45	  Cell cloneInto(Cell cell);

.. Seems odd we'd 'cloneInto' something that allocates.





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

Mime
View raw message