hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-14657 Remove unneeded API from EncodedSeeker (Heng Chen)
Date Thu, 22 Oct 2015 21:20:35 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 467bc098a -> c21e8ed1d


HBASE-14657 Remove unneeded API from EncodedSeeker (Heng Chen)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c21e8ed1
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c21e8ed1
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c21e8ed1

Branch: refs/heads/master
Commit: c21e8ed1d860f3b380b260890d04cd2c492ab0a3
Parents: 467bc09
Author: stack <stack@apache.org>
Authored: Thu Oct 22 14:20:28 2015 -0700
Committer: stack <stack@apache.org>
Committed: Thu Oct 22 14:20:28 2015 -0700

----------------------------------------------------------------------
 .../io/encoding/BufferedDataBlockEncoder.java   | 32 --------------------
 .../hbase/io/encoding/DataBlockEncoder.java     |  4 ---
 .../codec/prefixtree/PrefixTreeSeeker.java      |  8 -----
 .../io/encoding/TestDataBlockEncoders.java      |  7 +++--
 4 files changed, 4 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c21e8ed1/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 87a5b79..8919d01 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
@@ -760,38 +760,6 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
     }
 
     @Override
-    public ByteBuffer getKeyValueBuffer() {
-      ByteBuffer kvBuffer = createKVBuffer();
-      kvBuffer.putInt(current.keyLength);
-      kvBuffer.putInt(current.valueLength);
-      kvBuffer.put(current.keyBuffer, 0, current.keyLength);
-      currentBuffer.get(kvBuffer, current.valueOffset, current.valueLength);
-      if (current.tagsLength > 0) {
-        // Put short as unsigned
-        kvBuffer.put((byte) (current.tagsLength >> 8 & 0xff));
-        kvBuffer.put((byte) (current.tagsLength & 0xff));
-        if (current.tagsOffset != -1) {
-          // the offset of the tags bytes in the underlying buffer is marked. So the temp
-          // buffer,tagsBuffer was not been used.
-          currentBuffer.get(kvBuffer, current.tagsOffset, current.tagsLength);
-        } else {
-          // When tagsOffset is marked as -1, tag compression was present and so the tags
were
-          // uncompressed into temp buffer, tagsBuffer. Let us copy it from there
-          kvBuffer.put(current.tagsBuffer, 0, current.tagsLength);
-        }
-      }
-      kvBuffer.rewind();
-      return kvBuffer;
-    }
-
-    protected ByteBuffer createKVBuffer() {
-      int kvBufSize = (int) KeyValue.getKeyValueDataStructureSize(current.keyLength,
-          current.valueLength, current.tagsLength);
-      ByteBuffer kvBuffer = ByteBuffer.allocate(kvBufSize);
-      return kvBuffer;
-    }
-
-    @Override
     public Cell getCell() {
       return current.toCell();
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/c21e8ed1/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 ed4528c..397855a 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
@@ -154,10 +154,6 @@ public interface DataBlockEncoder {
      * @return value at current position
      */
     ByteBuffer getValueShallowCopy();
-    
-    //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();
 
     /**
      * @return the Cell at the current position. Includes memstore timestamp.

http://git-wip-us.apache.org/repos/asf/hbase/blob/c21e8ed1/hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/PrefixTreeSeeker.java
----------------------------------------------------------------------
diff --git a/hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/PrefixTreeSeeker.java
b/hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/PrefixTreeSeeker.java
index 71935e3..4be72fd 100644
--- a/hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/PrefixTreeSeeker.java
+++ b/hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/PrefixTreeSeeker.java
@@ -90,14 +90,6 @@ public class PrefixTreeSeeker implements EncodedSeeker {
    * currently must do deep copy into new array
    */
   @Override
-  public ByteBuffer getKeyValueBuffer() {
-    return KeyValueUtil.copyToNewByteBuffer(ptSearcher.current());
-  }
-
-  /**
-   * currently must do deep copy into new array
-   */
-  @Override
   public Cell getCell() {
     // The PrefixTreecell is of type BytebufferedCell and the value part of the cell
     // determines whether we are offheap cell or onheap cell.  All other parts of the cell-

http://git-wip-us.apache.org/repos/asf/hbase/blob/c21e8ed1/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java
----------------------------------------------------------------------
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 63fe57b..2e9e973 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
@@ -17,6 +17,7 @@
 package org.apache.hadoop.hbase.io.encoding;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
@@ -333,14 +334,14 @@ public class TestDataBlockEncoders {
 
   private void checkSeekingConsistency(List<DataBlockEncoder.EncodedSeeker> encodedSeekers,
       boolean seekBefore, Cell keyValue) {
-    ByteBuffer expectedKeyValue = null;
+    Cell expectedKeyValue = null;
     ByteBuffer expectedKey = null;
     ByteBuffer expectedValue = null;
     for (DataBlockEncoder.EncodedSeeker seeker : encodedSeekers) {
       seeker.seekToKeyInBlock(keyValue, seekBefore);
       seeker.rewind();
 
-      ByteBuffer actualKeyValue = seeker.getKeyValueBuffer();
+      Cell actualKeyValue = seeker.getCell();
       ByteBuffer actualKey = null;
       if (seeker instanceof PrefixTreeSeeker) {
         byte[] serializedKey = CellUtil.getCellKeySerializedAsKeyValueKey(seeker.getKey());
@@ -351,7 +352,7 @@ public class TestDataBlockEncoders {
       ByteBuffer actualValue = seeker.getValueShallowCopy();
 
       if (expectedKeyValue != null) {
-        assertEquals(expectedKeyValue, actualKeyValue);
+        assertTrue(CellUtil.equals(expectedKeyValue, actualKeyValue));
       } else {
         expectedKeyValue = actualKeyValue;
       }


Mime
View raw message