hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject [2/4] hbase git commit: HBASE-13329 ArrayIndexOutOfBoundsException in CellComparator#getMinimumMidpointArray.
Date Sun, 05 Jul 2015 19:23:23 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/e3f0705f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e3f0705f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e3f0705f

Branch: refs/heads/branch-1.2
Commit: e3f0705f19638ff9e98e36b3eaf0c0b2463bcaf6
Parents: 23d05e6
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:19:19 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/e3f0705f/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 fc5860a..d8fcfe4 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
@@ -486,7 +486,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/e3f0705f/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 3bc7a12..a6e7293 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
@@ -3343,6 +3343,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.flush(false);
+    HRegion.closeHRegion(this.region);
+    this.region = null;
+  }
   // ////////////////////////////////////////////////////////////////////////////
   // Split test
   // ////////////////////////////////////////////////////////////////////////////


Mime
View raw message