You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2015/09/24 19:56:27 UTC
[2/3] hbase git commit: HBASE-14397 PrefixFilter doesn't filter all
remaining rows if the prefix is longer than rowkey being compared (Jianwei
Cui)
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/06f12708
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/06f12708
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/06f12708
Branch: refs/heads/0.98
Commit: 06f12708e85439c486c4dc831a0f496b18f7dab6
Parents: 1c00e2d
Author: tedyu <yu...@gmail.com>
Authored: Fri Sep 11 16:07:49 2015 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue Sep 22 09:46:24 2015 -0700
----------------------------------------------------------------------
.../java/org/apache/hadoop/hbase/filter/PrefixFilter.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/06f12708/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 323cd69..92c94b0 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
@@ -38,9 +38,11 @@ import java.util.ArrayList;
@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;
@@ -53,8 +55,12 @@ public class PrefixFilter extends FilterBase {
public boolean filterRowKey(byte[] buffer, int offset, int length) {
if (buffer == null || this.prefix == null)
return true;
- if (length < prefix.length)
+ 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