You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2015/09/12 01:04:37 UTC

hbase git commit: HBASE-14397 PrefixFilter doesn't filter all remaining rows if the prefix is longer than rowkey being compared (Jianwei Cui)

Repository: hbase
Updated Branches:
  refs/heads/master dff5243c8 -> 36675c81f


HBASE-14397 PrefixFilter doesn't filter all remaining rows if the prefix is longer than rowkey being compared (Jianwei Cui)


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

Branch: refs/heads/master
Commit: 36675c81fb2803418191e44c7eb9560a92a23411
Parents: dff5243
Author: tedyu <yu...@gmail.com>
Authored: Fri Sep 11 16:04:31 2015 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Fri Sep 11 16:04:31 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/filter/PrefixFilter.java   | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/36675c81/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java
index 8a62b9b..7e35673 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java
@@ -40,9 +40,11 @@ import com.google.protobuf.InvalidProtocolBufferException;
 @InterfaceAudience.Public
 @InterfaceStability.Stable
 public class PrefixFilter extends FilterBase {
+  public static final int MAX_SKIPPED_COMPARE_ROW_NUM = 100;
   protected byte [] prefix = null;
   protected boolean passedPrefix = false;
   protected boolean filterRow = true;
+  protected int skippedCompareRows = 0;
 
   public PrefixFilter(final byte [] prefix) {
     this.prefix = prefix;
@@ -56,7 +58,12 @@ public class PrefixFilter extends FilterBase {
     if (firstRowCell == null || this.prefix == null)
       return true;
     int length = firstRowCell.getRowLength();
-    if (length < prefix.length) return true;
+    if (length < prefix.length && skippedCompareRows < MAX_SKIPPED_COMPARE_ROW_NUM) {
+      ++skippedCompareRows;
+      return true;
+    }   
+    skippedCompareRows = 0;
+    
     // if they are equal, return false => pass row
     // else return true, filter row
     // if we are passed the prefix, set flag