hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1584191 - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/io/encoding/FastDiffDeltaEncoder.java test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java
Date Wed, 02 Apr 2014 21:10:59 GMT
Author: liyin
Date: Wed Apr  2 21:10:59 2014
New Revision: 1584191

URL: http://svn.apache.org/r1584191
Log:
[HBASE-10893] Fixing critical bug in FastDiffDeltaEncoder

Author: manukranthk

Summary:
The bug arose due to the following :
  getCommonPrefix(buf1, offset1, length1, buf2, offset2, length2)
was called with the following..
  getCommonPrefix(buf1, buf1.offset, buf1.length, buf2, buf2.offset, buf2.length)

Test Plan: Adding unit test testZeroByte

Reviewers: liyintang, rshroff, adela

Reviewed By: liyintang

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D1253091

Task ID: 4049110

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/encoding/FastDiffDeltaEncoder.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/encoding/FastDiffDeltaEncoder.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/encoding/FastDiffDeltaEncoder.java?rev=1584191&r1=1584190&r2=1584191&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/encoding/FastDiffDeltaEncoder.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/encoding/FastDiffDeltaEncoder.java
Wed Apr  2 21:10:59 2014
@@ -334,7 +334,7 @@ public class FastDiffDeltaEncoder extend
         // length first as an optimization.
         if (valueLength == this.prevState.valueLength) {
           if (valueLength == getCommonPrefixLength(value, valueOffset, valueLength,
-              this.prevState.value, this.prevState.valueLength,
+              this.prevState.value, this.prevState.valueOffset,
               this.prevState.valueLength)) {
             // if common prefix consists of whole value length
             flag |= FLAG_SAME_VALUE;

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java?rev=1584191&r1=1584190&r2=1584191&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java
(original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java
Wed Apr  2 21:10:59 2014
@@ -117,6 +117,26 @@ public class TestDataBlockEncoders {
   }
 
   /**
+   * Test KeyValues with negative timestamp.
+   * @throws IOException On test failure.
+   */
+  @Test
+  public void testZeroByte() throws IOException {
+    List<KeyValue> kvList = new ArrayList<KeyValue>();
+    byte[] row = Bytes.toBytes("abcd");
+    byte[] family = new byte[] { 'f' };
+    byte[] qualifier0 = new byte[] { 'b' };
+    byte[] qualifier1 = new byte[] { 'c' };
+    byte[] value0 = new byte[] { 'd' };
+    byte[] value1 = new byte[] { 0x00 };
+    kvList.add(new KeyValue(row, family, qualifier0, 0, Type.Put, value0));
+    kvList.add(new KeyValue(row, family, qualifier1, 0, Type.Put, value1));
+    testEncodersOnDataset(
+        RedundantKVGenerator.convertKvToByteBuffer(kvList,
+            includesMemstoreTS));
+  }
+
+  /**
    * Test whether compression -> decompression gives the consistent results on
    * pseudorandom sample.
    * @throws IOException On test failure.
@@ -339,4 +359,4 @@ public class TestDataBlockEncoders {
       assertEquals("Input of two methods is changed", onDataset, dataset);
     }
   }
-}
\ No newline at end of file
+}



Mime
View raw message