HBASE-24483 Add repeated prefix logging for MultipleColumnPrefixFilter (#1822)
Signed-off-by: clarax Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
0ef421549a
commit
5e8ed21a37
|
@ -32,6 +32,8 @@ import org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferExce
|
||||||
import org.apache.hbase.thirdparty.com.google.protobuf.UnsafeByteOperations;
|
import org.apache.hbase.thirdparty.com.google.protobuf.UnsafeByteOperations;
|
||||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos;
|
import org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
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
|
* This filter is used for selecting only those keys with columns that matches
|
||||||
|
@ -40,15 +42,18 @@ import org.apache.hadoop.hbase.util.Bytes;
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.Public
|
@InterfaceAudience.Public
|
||||||
public class MultipleColumnPrefixFilter extends FilterBase {
|
public class MultipleColumnPrefixFilter extends FilterBase {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(MultipleColumnPrefixFilter.class);
|
||||||
protected byte [] hint = null;
|
protected byte [] hint = null;
|
||||||
protected TreeSet<byte []> sortedPrefixes = createTreeSet();
|
protected TreeSet<byte []> sortedPrefixes = createTreeSet();
|
||||||
private final static int MAX_LOG_PREFIXES = 5;
|
private final static int MAX_LOG_PREFIXES = 5;
|
||||||
|
|
||||||
public MultipleColumnPrefixFilter(final byte [][] prefixes) {
|
public MultipleColumnPrefixFilter(final byte [][] prefixes) {
|
||||||
if (prefixes != null) {
|
if (prefixes != null) {
|
||||||
for (int i = 0; i < prefixes.length; i++) {
|
for (byte[] prefix : prefixes) {
|
||||||
if (!sortedPrefixes.add(prefixes[i]))
|
if (!sortedPrefixes.add(prefix)) {
|
||||||
throw new IllegalArgumentException ("prefixes must be distinct");
|
LOG.error("prefix {} is repeated", Bytes.toString(prefix));
|
||||||
|
throw new IllegalArgumentException("prefixes must be distinct");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue