Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D819118424 for ; Wed, 24 Jun 2015 03:44:59 +0000 (UTC) Received: (qmail 131 invoked by uid 500); 24 Jun 2015 03:44:59 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 99943 invoked by uid 500); 24 Jun 2015 03:44:59 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 99934 invoked by uid 99); 24 Jun 2015 03:44:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2015 03:44:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 69A57E33C9; Wed, 24 Jun 2015 03:44:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ramkrishna@apache.org To: commits@hbase.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-13945 - Prefix_Tree seekBefore() does not work correctly (Ram) Date: Wed, 24 Jun 2015 03:44:59 +0000 (UTC) Repository: hbase Updated Branches: refs/heads/branch-1.2 2f004303d -> 994c728bc HBASE-13945 - Prefix_Tree seekBefore() does not work correctly (Ram) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/994c728b Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/994c728b Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/994c728b Branch: refs/heads/branch-1.2 Commit: 994c728bc40c567e9c7eac69a504db2cd204f452 Parents: 2f00430 Author: ramkrishna Authored: Wed Jun 24 09:12:29 2015 +0530 Committer: ramkrishna Committed: Wed Jun 24 09:14:31 2015 +0530 ---------------------------------------------------------------------- .../main/java/org/apache/hadoop/hbase/KeyValueUtil.java | 12 ++++++++++-- .../hbase/io/encoding/BufferedDataBlockEncoder.java | 2 ++ .../hadoop/hbase/io/encoding/DataBlockEncoder.java | 5 +++-- .../org/apache/hadoop/hbase/io/hfile/TestSeekTo.java | 5 +---- 4 files changed, 16 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/994c728b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java index 77a39ff..38b9470 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java @@ -105,11 +105,15 @@ public class KeyValueUtil { return kvCell; } + /** + * The position will be set to the beginning of the new ByteBuffer + * @param cell + * @return the Bytebuffer containing the key part of the cell + */ public static ByteBuffer copyKeyToNewByteBuffer(final Cell cell) { byte[] bytes = new byte[keyLength(cell)]; appendKeyTo(cell, bytes, 0); ByteBuffer buffer = ByteBuffer.wrap(bytes); - buffer.position(buffer.limit());//make it look as if each field were appended return buffer; } @@ -151,11 +155,15 @@ public class KeyValueUtil { return pos; } + /** + * The position will be set to the beginning of the new ByteBuffer + * @param cell + * @return the ByteBuffer containing the cell + */ public static ByteBuffer copyToNewByteBuffer(final Cell cell) { byte[] bytes = new byte[length(cell)]; appendToByteArray(cell, bytes, 0); ByteBuffer buffer = ByteBuffer.wrap(bytes); - buffer.position(buffer.limit());//make it look as if each field were appended return buffer; } http://git-wip-us.apache.org/repos/asf/hbase/blob/994c728b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java index 93fd3a4..e872856 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java @@ -582,6 +582,7 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder { public ByteBuffer getKeyDeepCopy() { ByteBuffer keyBuffer = ByteBuffer.allocate(current.keyLength); keyBuffer.put(current.keyBuffer, 0, current.keyLength); + keyBuffer.rewind(); return keyBuffer; } @@ -616,6 +617,7 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder { kvBuffer.put(current.tagsBuffer, 0, current.tagsLength); } } + kvBuffer.rewind(); return kvBuffer; } http://git-wip-us.apache.org/repos/asf/hbase/blob/994c728b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/DataBlockEncoder.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/DataBlockEncoder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/DataBlockEncoder.java index 0e85380..7218ad5 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/DataBlockEncoder.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/DataBlockEncoder.java @@ -153,8 +153,9 @@ public interface DataBlockEncoder { * @return value at current position */ ByteBuffer getValueShallowCopy(); - - /** @return key value at current position with position set to limit */ + + //TODO : to be removed - currently used in testcases only + /** @return a key value buffer with the position set at the beginning of the buffer */ ByteBuffer getKeyValueBuffer(); /** http://git-wip-us.apache.org/repos/asf/hbase/blob/994c728b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestSeekTo.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestSeekTo.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestSeekTo.java index a7712b2..1a190fd 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestSeekTo.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestSeekTo.java @@ -64,10 +64,7 @@ public class TestSeekTo { public static Collection parameters() { List paramList = new ArrayList(); for (DataBlockEncoding encoding : DataBlockEncoding.values()) { - // Remove after HBASE-13939 - if (encoding != DataBlockEncoding.PREFIX_TREE) { - paramList.add(new Object[] { encoding }); - } + paramList.add(new Object[] { encoding }); } return paramList; }