hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject [4/4] hbase git commit: HBASE-13329 ArrayIndexOutOfBoundsException in CellComparator#getMinimumMidpointArray.
Date Sun, 05 Jul 2015 19:23:25 GMT
HBASE-13329 ArrayIndexOutOfBoundsException in CellComparator#getMinimumMidpointArray.


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

Branch: refs/heads/branch-1.0
Commit: 4b934b5734238675e27aaf426e4236e61c57d538
Parents: ec4ff44
Author: Lars Hofhansl <larsh@apache.org>
Authored: Sun Jul 5 12:18:59 2015 -0700
Committer: Lars Hofhansl <larsh@apache.org>
Committed: Sun Jul 5 12:22:40 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/CellComparator.java |  2 +-
 .../hadoop/hbase/regionserver/TestHRegion.java  | 24 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4b934b57/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
index 2c1cc09..5f87858 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparator.java
@@ -472,7 +472,7 @@ public class CellComparator implements Comparator<Cell>, Serializable
{
       final byte [] rightArray, final int rightOffset, final int rightLength) {
     // rows are different
     int minLength = leftLength < rightLength ? leftLength : rightLength;
-    short diffIdx = 0;
+    int diffIdx = 0;
     while (diffIdx < minLength &&
         leftArray[leftOffset + diffIdx] == rightArray[rightOffset + diffIdx]) {
       diffIdx++;

http://git-wip-us.apache.org/repos/asf/hbase/blob/4b934b57/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
index 7bf6802..a20c271 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
@@ -3306,6 +3306,30 @@ public class TestHRegion {
     }
   }
 
+  /**
+   * Write an HFile block full with Cells whose qualifier that are identical between
+   * 0 and Short.MAX_VALUE. See HBASE-13329.
+   * @throws Exception
+   */
+  @Test
+  public void testLongQualifier() throws Exception {
+    String method = name.getMethodName();
+    TableName tableName = TableName.valueOf(method);
+    byte[] family = Bytes.toBytes("family");
+    this.region = initHRegion(tableName, method, CONF, family);
+    byte[] q = new byte[Short.MAX_VALUE+2];
+    Arrays.fill(q, 0, q.length-1, (byte)42);
+    for (byte i=0; i<10; i++) {
+      Put p = new Put(Bytes.toBytes("row"));
+      // qualifiers that differ past Short.MAX_VALUE
+      q[q.length-1]=i;
+      p.addColumn(family, q, q);
+      region.put(p);
+    }
+    region.flushcache();
+    HRegion.closeHRegion(this.region);
+    this.region = null;
+  }
   // ////////////////////////////////////////////////////////////////////////////
   // Split test
   // ////////////////////////////////////////////////////////////////////////////


Mime
View raw message