You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by vj...@apache.org on 2020/06/08 11:04:47 UTC
[hbase] branch branch-1 updated: HBASE-24483 Add repeated prefix
logging for MultipleColumnPrefixFilter (#1822)
This is an automated email from the ASF dual-hosted git repository.
vjasani pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-1 by this push:
new b6598cc HBASE-24483 Add repeated prefix logging for MultipleColumnPrefixFilter (#1822)
b6598cc is described below
commit b6598ccaad21a13d78f1c53d9d583c0e511ad3e9
Author: bsglz <18...@qq.com>
AuthorDate: Mon Jun 8 18:48:33 2020 +0800
HBASE-24483 Add repeated prefix logging for MultipleColumnPrefixFilter (#1822)
Signed-off-by: clarax
Signed-off-by: Viraj Jasani <vj...@apache.org>
---
.../hadoop/hbase/filter/MultipleColumnPrefixFilter.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
index cd1b24b..25a7828 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultipleColumnPrefixFilter.java
@@ -33,6 +33,8 @@ import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos;
import org.apache.hadoop.hbase.util.ByteStringer;
import org.apache.hadoop.hbase.util.Bytes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This filter is used for selecting only those keys with columns that matches
@@ -42,15 +44,18 @@ import org.apache.hadoop.hbase.util.Bytes;
@InterfaceAudience.Public
@InterfaceStability.Stable
public class MultipleColumnPrefixFilter extends FilterBase {
+ private static final Logger LOG = LoggerFactory.getLogger(MultipleColumnPrefixFilter.class);
protected byte [] hint = null;
protected TreeSet<byte []> sortedPrefixes = createTreeSet();
private final static int MAX_LOG_PREFIXES = 5;
public MultipleColumnPrefixFilter(final byte [][] prefixes) {
if (prefixes != null) {
- for (int i = 0; i < prefixes.length; i++) {
- if (!sortedPrefixes.add(prefixes[i]))
- throw new IllegalArgumentException ("prefixes must be distinct");
+ for (byte[] prefix : prefixes) {
+ if (!sortedPrefixes.add(prefix)) {
+ LOG.error("prefix {} is repeated", Bytes.toString(prefix));
+ throw new IllegalArgumentException("prefixes must be distinct");
+ }
}
}
}