.../src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java | 12 ++++++++++-- .../hadoop/hbase/io/encoding/TestDataBlockEncoders.java | 2 ++ .../java/org/apache/hadoop/hbase/io/hfile/TestSeekTo.java | 5 +---- 3 files changed, 13 insertions(+), 6 deletions(-) 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 407c017..4730fa5 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 @@ -106,11 +106,15 @@ public class KeyValueUtil { return kvCell; } + /** + * The position will be set to the beginning of the new ByteBuffer + * @param cell + * @return + */ 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; } @@ -152,11 +156,15 @@ public class KeyValueUtil { return pos; } + /** + * The position will be set to the beginning of the new ByteBuffer + * @param cell + * @return + */ 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; } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java index fbe8164..1be07d3 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java @@ -327,7 +327,9 @@ public class TestDataBlockEncoders { seeker.rewind(); ByteBuffer actualKeyValue = seeker.getKeyValueBuffer(); + actualKeyValue.position(actualKeyValue.limit()); ByteBuffer actualKey = seeker.getKeyDeepCopy(); + actualKey.position(actualKey.limit()); ByteBuffer actualValue = seeker.getValueShallowCopy(); if (expectedKeyValue != null) { 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 e9bf33e..7fdb5b9 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 @@ -65,10 +65,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; }