You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Matt Corgan (JIRA)" <ji...@apache.org> on 2014/05/01 06:22:16 UTC

[jira] [Commented] (HBASE-10835) DBE encode path improvements

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

Matt Corgan commented on HBASE-10835:
-------------------------------------

{code}
+@InterfaceAudience.Private
+public class EncoderPoolImpl implements EncoderPool {
+
+  private List<PrefixTreeEncoder> unusedEncoders = new ArrayList<PrefixTreeEncoder>();
+
+  @Override
+  public PrefixTreeEncoder checkOut(OutputStream outputStream, boolean includeMvccVersion) {
+    PrefixTreeEncoder encoder = null;
+    synchronized (this) {
+      if (!unusedEncoders.isEmpty()) {
+        encoder = unusedEncoders.remove(0);
+      }
+    }
+    if (encoder == null) {
+      encoder = new PrefixTreeEncoder(outputStream, includeMvccVersion);
+    } else {
+      encoder.reset(outputStream, includeMvccVersion);
+    }
+    return encoder;
+  }
+
+  @Override
+  public void checkIn(PrefixTreeEncoder encoder) {
+    synchronized (this) {
+      this.unusedEncoders.add(encoder);
+    }
+  }
+}
{code}
instead of a plain ArrayList for unusedEncoders, maybe you should use a LinkedBlockingQueue?  then you wouldn't have to synchronize the methods

> DBE encode path improvements
> ----------------------------
>
>                 Key: HBASE-10835
>                 URL: https://issues.apache.org/jira/browse/HBASE-10835
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Anoop Sam John
>            Assignee: Anoop Sam John
>             Fix For: 0.99.0
>
>         Attachments: HBASE-10835.patch, HBASE-10835_V2.patch
>
>
> Here 1st we write KVs (Cells) into a buffer and then passed to DBE encoder. Encoder again reads kvs one by one from the buffer and encodes and creates a new buffer.
> There is no need to have this model now. Previously we had option of no encode in disk and encode only in cache. At that time the read buffer from a HFile block was passed to this and encodes.
> So encode cell by cell can be done now. Making this change will need us to have a NoOp DBE impl which just do the write of a cell as it is with out any encoding.



--
This message was sent by Atlassian JIRA
(v6.2#6252)