You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ra...@apache.org on 2015/06/24 05:41:41 UTC

hbase git commit: HBASE-13945 - Prefix_Tree seekBefore() does not work correctly (Ram)

Repository: hbase
Updated Branches:
  refs/heads/master 76d6700d2 -> d7356667b


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/d7356667
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d7356667
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d7356667

Branch: refs/heads/master
Commit: d7356667be64b3244587b9fe0d8e3412e0b2b2c6
Parents: 76d6700
Author: ramkrishna <ra...@gmail.com>
Authored: Wed Jun 24 09:11:05 2015 +0530
Committer: ramkrishna <ra...@gmail.com>
Committed: Wed Jun 24 09:11:05 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/d7356667/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 407c017..9a935bf 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 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;
   }
 
@@ -152,11 +156,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/d7356667/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 765436f..8e85435 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
@@ -644,6 +644,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;
     }
 
@@ -678,6 +679,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/d7356667/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 f084689..9019376 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/d7356667/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 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<Object[]> parameters() {
     List<Object[]> paramList = new ArrayList<Object[]>();
     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;
   }