hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-14206 MultiRowRangeFilter returns records whose rowKeys are out of allowed ranges (Anton Nazaruk)
Date Tue, 11 Aug 2015 17:02:03 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 c07eb21e4 -> 90b8cc89b


HBASE-14206 MultiRowRangeFilter returns records whose rowKeys are out of allowed ranges (Anton
Nazaruk)


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

Branch: refs/heads/branch-1
Commit: 90b8cc89bdd0e67bdbaab97f24f6d2a3887a651a
Parents: c07eb21
Author: tedyu <yuzhihong@gmail.com>
Authored: Tue Aug 11 10:01:55 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Tue Aug 11 10:01:55 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/filter/MultiRowRangeFilter.java  |  3 +++
 .../hbase/filter/TestMultiRowRangeFilter.java     | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/90b8cc89/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
index ca4f9b0..7efda86 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java
@@ -233,6 +233,9 @@ public class MultiRowRangeFilter extends FilterBase {
       if (insertionPosition == 0 && !rangeList.get(insertionPosition).contains(rowKey))
{
         return ROW_BEFORE_FIRST_RANGE;
       }
+      if (!initialized) {
+        initialized = true;
+      }
       return insertionPosition;
     }
     // the row key equals one of the start keys, and the the range exclude the start key

http://git-wip-us.apache.org/repos/asf/hbase/blob/90b8cc89/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestMultiRowRangeFilter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestMultiRowRangeFilter.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestMultiRowRangeFilter.java
index 0c596aa..dfa8bfa 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestMultiRowRangeFilter.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestMultiRowRangeFilter.java
@@ -70,6 +70,24 @@ public class TestMultiRowRangeFilter {
   }
 
   @Test
+  public void testRanges() throws IOException {
+    byte[] key1Start = new byte[] {-3};
+    byte[] key1End  = new byte[] {-2};
+
+    byte[] key2Start = new byte[] {5};
+    byte[] key2End  = new byte[] {6};
+
+    byte[] badKey = new byte[] {-10};
+
+    MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
+      new MultiRowRangeFilter.RowRange(key1Start, true, key1End, false),
+      new MultiRowRangeFilter.RowRange(key2Start, true, key2End, false)
+        ));
+    filter.filterRowKey(badKey, 0, 1);
+    assertEquals(Filter.ReturnCode.SEEK_NEXT_USING_HINT, filter.filterKeyValue(null));
+  }
+
+  @Test
   public void testOutOfOrderScannerNextException() throws Exception {
     MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
             new MultiRowRangeFilter.RowRange(Bytes.toBytes("b"), true, Bytes.toBytes("c"),
true),


Mime
View raw message