hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anoop Sam John (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-16888) Avoid unnecessary tags copy in Append
Date Mon, 24 Oct 2016 11:45:58 GMT

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

Anoop Sam John commented on HBASE-16888:
----------------------------------------

Understood..
So now we would end up copying tags in original cell which the TagRewriteCell wraps.  The
patch makes it such that we will avoid that.  But now we will not copy the tags in TagRewriteCell
as such but the patch will make it to copy.
bq.return new TagRewriteCell(clonedBaseCell, this.tags);
Actually speaking we will not be having tags in the original cell what we receive.  Its different
CPs and internal code path adds up tags.
TagRewriteCell constructor
{code}
this.cell = cell;
      this.tags = tags;
      // tag offset will be treated as 0 and length this.tags.length
      if (this.cell instanceof TagRewriteCell) {
        // Cleaning the ref so that the byte[] can be GCed
        ((TagRewriteCell) this.cell).tags = null;
      }
{code}
We can do a bit of change here.
When the wrapping cell is also a TagRewriteCell we can gets its wrapped instance and make
it this.cell.  I mean doing this
{code}
if (this.cell instanceof TagRewriteCell) {
        this.cell = ((TagRewriteCell) cell).cell;
      } else {
        this.cell = cell;
      }
{code}
What this is doing is even if we have N levels of TagRewriteCells, the top most originally
refer to the bottom most one which might in all chance dont have any cells in it.  Is that
better than copying the current TagRewriteCell's tags bytes?



> Avoid unnecessary tags copy in Append
> -------------------------------------
>
>                 Key: HBASE-16888
>                 URL: https://issues.apache.org/jira/browse/HBASE-16888
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: ChiaPing Tsai
>            Assignee: ChiaPing Tsai
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: HBASE-16888.v0.patch
>
>
> a) If the delta has tags and the mutation doesn’t apply the TTL, we shouldn’t create
the TagRewriteCell.
> {noformat}
>     List<Tag> tags = TagUtil.carryForwardTags(delta);
>     long ts = now;
>     Cell newCell = null;
>     byte [] row = mutation.getRow();
>     if (currentValue != null) {
>      ...
>     } else {
>       // Append's KeyValue.Type==Put and ts==HConstants.LATEST_TIMESTAMP
>       CellUtil.updateLatestStamp(delta, now);
>       newCell = delta;
>       tags = TagUtil.carryForwardTTLTag(tags, mutation.getTTL());
>       if (tags != null) {
>         newCell = CellUtil.createCell(delta, tags);
>       }
>     }
> {noformat}
> b) If the cell has tags, the ShareableMemoryTagRewriteCell will make duplicate copy of
tags. 
> {noformat}
>       Cell clonedBaseCell = ((ShareableMemory) this.cell).cloneToCell();
>       return new TagRewriteCell(clonedBaseCell, this.tags);
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message