You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Anoop Sam John (JIRA)" <ji...@apache.org> on 2016/10/06 17:46:20 UTC
[jira] [Commented] (HBASE-16784) Make use of
ExtendedCell#write(OutputStream os) for the default HFileWriter#append()
[ https://issues.apache.org/jira/browse/HBASE-16784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15552641#comment-15552641 ]
Anoop Sam John commented on HBASE-16784:
----------------------------------------
{code}
int klength = KeyValueUtil.keyLength(cell);
int vlength = cell.getValueLength();
out.writeInt(klength);
out.writeInt(vlength);
CellUtil.writeFlatKey(cell, out);
CellUtil.writeValue(out, cell, vlength);
int size = klength + vlength + KeyValue.KEYVALUE_INFRASTRUCTURE_SIZE;
// Write the additional tag into the stream
if (encodingCtx.getHFileContext().isIncludesTags()) {
int tagsLength = cell.getTagsLength();
out.writeShort(tagsLength);
if (tagsLength > 0) {
CellUtil.writeTags(out, cell, tagsLength);
}
size += tagsLength + KeyValue.TAGS_LENGTH_SIZE;
}
{code}
All these can be replaced with calling KVUtil#oswrite(final Cell cell, final OutputStream out, final boolean withTags) and passing encodingCtx.getHFileContext().isIncludesTags() boolean.
Now this KVUtil method is not returning the #bytes written. We can change that. The ExtendedCell API do return that. So this will avoid many length parsing.
> Make use of ExtendedCell#write(OutputStream os) for the default HFileWriter#append()
> ------------------------------------------------------------------------------------
>
> Key: HBASE-16784
> URL: https://issues.apache.org/jira/browse/HBASE-16784
> Project: HBase
> Issue Type: Improvement
> Affects Versions: 2.0.0
> Reporter: ramkrishna.s.vasudevan
> Assignee: ramkrishna.s.vasudevan
> Fix For: 2.0.0
>
> Attachments: HBASE-16784.patch
>
>
> Initially this I was thinking we need to add an interface to represent the fact that the key is contiguous. But since Extendedcell is added encapsulating all the internal interfaces and adds a write(OutputStream , boolean) and tries to exploit the fact that the Cell is in KV serialized format. Hence we can make use of it in HFileWriter#append() code in case of No encoding case.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)