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-13704 Hbase throws OutOfOrderScannerNextException when MultiRowRangeFilter is used (Aleksandr Maksymenko)
Date Wed, 20 May 2015 03:22:16 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.1 bd6276ebf -> ebdd45be8


HBASE-13704 Hbase throws OutOfOrderScannerNextException when MultiRowRangeFilter is used (Aleksandr
Maksymenko)


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

Branch: refs/heads/branch-1.1
Commit: ebdd45be85344b24fb2fdc5349e58e97193b6b8d
Parents: bd6276e
Author: tedyu <yuzhihong@gmail.com>
Authored: Tue May 19 20:22:07 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Tue May 19 20:22:07 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/filter/MultiRowRangeFilter.java |  6 ++++--
 .../hbase/filter/TestMultiRowRangeFilter.java    | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ebdd45be/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 4005f38..24c8135 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
@@ -102,7 +102,7 @@ public class MultiRowRangeFilter extends FilterBase {
       } else {
         range = rangeList.get(0);
       }
-      if(EXCLUSIVE) {
+      if (EXCLUSIVE) {
         EXCLUSIVE = false;
         currentReturnCode = ReturnCode.NEXT_ROW;
         return false;
@@ -115,7 +115,9 @@ public class MultiRowRangeFilter extends FilterBase {
         }
         initialized = true;
       } else {
-        currentReturnCode = ReturnCode.SEEK_NEXT_USING_HINT;
+        if (range.contains(buffer, offset, length)) {
+          currentReturnCode = ReturnCode.INCLUDE;
+        } else currentReturnCode = ReturnCode.SEEK_NEXT_USING_HINT;
       }
     } else {
       currentReturnCode = ReturnCode.INCLUDE;

http://git-wip-us.apache.org/repos/asf/hbase/blob/ebdd45be/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 c2d25de..7ecc29c 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
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals;
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
@@ -69,6 +70,24 @@ public class TestMultiRowRangeFilter {
   }
 
   @Test
+  public void testOutOfOrderScannerNextException() throws Exception {
+    MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
+            new MultiRowRangeFilter.RowRange(Bytes.toBytes("b"), true, Bytes.toBytes("c"),
true),
+            new MultiRowRangeFilter.RowRange(Bytes.toBytes("d"), true, Bytes.toBytes("e"),
true)
+    ));
+    filter.filterRowKey(Bytes.toBytes("a"), 0, 1);
+    assertEquals(Filter.ReturnCode.SEEK_NEXT_USING_HINT, filter.filterKeyValue(null));
+    filter.filterRowKey(Bytes.toBytes("b"), 0, 1);
+    assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
+    filter.filterRowKey(Bytes.toBytes("c"), 0, 1);
+    assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
+    filter.filterRowKey(Bytes.toBytes("d"), 0, 1);
+    assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
+    filter.filterRowKey(Bytes.toBytes("e"), 0, 1);
+    assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
+  }
+
+  @Test
   public void testMergeAndSortWithEmptyStartRow() throws IOException {
     List<RowRange> ranges = new ArrayList<RowRange>();
     ranges.add(new RowRange(Bytes.toBytes(""), true, Bytes.toBytes(20), false));


Mime
View raw message