HBASE-600 Filters have excessive DEBUG logging

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@654229 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Kellerman 2008-05-07 19:35:47 +00:00
parent b3f4ddc1bc
commit eaa03f245b
7 changed files with 9 additions and 166 deletions

View File

@ -44,6 +44,7 @@ Hbase Change Log
the exception with a RetriesExhaustedException
HBASE-47 Option to set TTL for columns in hbase
(Andrew Purtell via Bryan Duxbury and Stack)
HBASE-600 Filters have excessive DEBUG logging
Release 0.1.1 - 04/11/2008

View File

@ -50,12 +50,7 @@ public class InclusiveStopRowFilter extends StopRowFilter{
}
return false;
}
boolean result = this.stopRowKey.compareTo(rowKey) < 0;
if (LOG.isDebugEnabled()) {
LOG.debug("Filter result for rowKey: " + rowKey + ". Result: " +
result);
}
return result;
return this.stopRowKey.compareTo(rowKey) < 0;
}
}

View File

@ -24,8 +24,6 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.SortedMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.Text;
/**
@ -46,8 +44,6 @@ public class PageRowFilter implements RowFilterInterface {
private long pageSize = Long.MAX_VALUE;
private int rowsAccepted = 0;
static final Log LOG = LogFactory.getLog(PageRowFilter.class);
/**
* Default constructor, filters nothing. Required though for RPC
* deserialization.
@ -86,10 +82,6 @@ public class PageRowFilter implements RowFilterInterface {
@SuppressWarnings("unused") Text rowKey) {
if (!filtered) {
this.rowsAccepted++;
if (LOG.isDebugEnabled()) {
LOG.debug("rowProcessed incremented rowsAccepted to " +
this.rowsAccepted);
}
}
}
@ -106,12 +98,7 @@ public class PageRowFilter implements RowFilterInterface {
* {@inheritDoc}
*/
public boolean filterAllRemaining() {
boolean result = this.rowsAccepted > this.pageSize;
if (LOG.isDebugEnabled()) {
LOG.debug("filtering decision is " + result + " with rowsAccepted: " +
this.rowsAccepted);
}
return result;
return this.rowsAccepted > this.pageSize;
}
/**

View File

@ -31,8 +31,6 @@ import java.util.SortedMap;
import java.util.Map.Entry;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.hbase.regionserver.HLogEdit;
@ -50,8 +48,6 @@ public class RegExpRowFilter implements RowFilterInterface {
private Map<Text, byte[]> equalsMap = new HashMap<Text, byte[]>();
private Set<Text> nullColumns = new HashSet<Text>();
static final Log LOG = LogFactory.getLog(RegExpRowFilter.class);
/**
* Default constructor, filters nothing. Required though for RPC
* deserialization.
@ -147,11 +143,7 @@ public class RegExpRowFilter implements RowFilterInterface {
*/
public boolean filterRowKey(final Text rowKey) {
if (filtersByRowKey() && rowKey != null) {
boolean result = !getRowKeyPattern().matcher(rowKey.toString()).matches();
if (LOG.isDebugEnabled()) {
LOG.debug("filter returning " + result + " for rowKey: " + rowKey);
}
return result;
return !getRowKeyPattern().matcher(rowKey.toString()).matches();
}
return false;
}
@ -168,27 +160,14 @@ public class RegExpRowFilter implements RowFilterInterface {
if (filtersByColumnValue()) {
byte[] filterValue = equalsMap.get(colKey);
if (null != filterValue) {
boolean result = !Arrays.equals(filterValue, data);
if (LOG.isDebugEnabled()) {
LOG.debug("filter returning " + result + " for rowKey: " + rowKey +
" colKey: " + colKey);
}
return result;
return !Arrays.equals(filterValue, data);
}
}
if (nullColumns.contains(colKey)) {
if (data != null && !HLogEdit.isDeleted(data)) {
if (LOG.isDebugEnabled()) {
LOG.debug("filter returning true for rowKey: " + rowKey +
" colKey: " + colKey);
}
return true;
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("filter returning false for rowKey: " + rowKey + " colKey: " +
colKey);
}
return false;
}
@ -200,25 +179,14 @@ public class RegExpRowFilter implements RowFilterInterface {
for (Entry<Text, byte[]> col : columns.entrySet()) {
if (nullColumns.contains(col.getKey())
&& !HLogEdit.isDeleted(col.getValue())) {
if (LOG.isDebugEnabled()) {
LOG.debug("filterNotNull returning true for colKey: " + col.getKey()
+ ", column should be null.");
}
return true;
}
}
for (Text col : equalsMap.keySet()) {
if (!columns.containsKey(col)) {
if (LOG.isDebugEnabled()) {
LOG.debug("filterNotNull returning true for colKey: " + col +
", column not found in given SortedMap<Text, byte[]>.");
}
return true;
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("filterNotNull returning false.");
}
return false;
}

View File

@ -26,8 +26,6 @@ import java.util.HashSet;
import java.util.Set;
import java.util.SortedMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.io.ObjectWritable;
@ -52,8 +50,6 @@ public class RowFilterSet implements RowFilterInterface {
private Operator operator = Operator.MUST_PASS_ALL;
private Set<RowFilterInterface> filters = new HashSet<RowFilterInterface>();
static final Log LOG = LogFactory.getLog(RowFilterSet.class);
/**
* Default constructor, filters nothing. Required though for RPC
* deserialization.
@ -88,10 +84,6 @@ public class RowFilterSet implements RowFilterInterface {
public void validate(final Text[] columns) {
for (RowFilterInterface filter : filters) {
filter.validate(columns);
if (LOG.isDebugEnabled()) {
LOG.debug("Validated subfilter of type " +
filter.getClass().getSimpleName());
}
}
}
@ -99,10 +91,6 @@ public class RowFilterSet implements RowFilterInterface {
public void reset() {
for (RowFilterInterface filter : filters) {
filter.reset();
if (LOG.isDebugEnabled()) {
LOG.debug("Reset subfilter of type " +
filter.getClass().getSimpleName());
}
}
}
@ -110,10 +98,6 @@ public class RowFilterSet implements RowFilterInterface {
public void rowProcessed(boolean filtered, Text rowKey) {
for (RowFilterInterface filter : filters) {
filter.rowProcessed(filtered, rowKey);
if (LOG.isDebugEnabled()) {
LOG.debug("Called rowProcessed on subfilter of type " +
filter.getClass().getSimpleName());
}
}
}
@ -121,10 +105,6 @@ public class RowFilterSet implements RowFilterInterface {
public boolean processAlways() {
for (RowFilterInterface filter : filters) {
if (filter.processAlways()) {
if (LOG.isDebugEnabled()) {
LOG.debug("processAlways() is true due to subfilter of type " +
filter.getClass().getSimpleName());
}
return true;
}
}
@ -137,25 +117,14 @@ public class RowFilterSet implements RowFilterInterface {
for (RowFilterInterface filter : filters) {
if (operator == Operator.MUST_PASS_ALL) {
if (filter.filterAllRemaining()) {
if (LOG.isDebugEnabled()) {
LOG.debug("op.MPALL filterAllRemaining returning true due" +
" to subfilter of type " + filter.getClass().getSimpleName());
}
return true;
}
} else if (operator == Operator.MUST_PASS_ONE) {
if (!filter.filterAllRemaining()) {
if (LOG.isDebugEnabled()) {
LOG.debug("op.MPONE filterAllRemaining returning false due" +
" to subfilter of type " + filter.getClass().getSimpleName());
}
return false;
}
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("filterAllRemaining default returning " + result);
}
return result;
}
@ -167,19 +136,11 @@ public class RowFilterSet implements RowFilterInterface {
if (!resultFound) {
if (operator == Operator.MUST_PASS_ALL) {
if (filter.filterAllRemaining() || filter.filterRowKey(rowKey)) {
if (LOG.isDebugEnabled()) {
LOG.debug("op.MPALL filter(Text) will return true due" +
" to subfilter of type " + filter.getClass().getSimpleName());
}
result = true;
resultFound = true;
}
} else if (operator == Operator.MUST_PASS_ONE) {
if (!filter.filterAllRemaining() && !filter.filterRowKey(rowKey)) {
if (LOG.isDebugEnabled()) {
LOG.debug("op.MPONE filter(Text) will return false due" +
" to subfilter of type " + filter.getClass().getSimpleName());
}
result = false;
resultFound = true;
}
@ -188,9 +149,6 @@ public class RowFilterSet implements RowFilterInterface {
filter.filterRowKey(rowKey);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("filter(Text) returning " + result);
}
return result;
}
@ -204,22 +162,12 @@ public class RowFilterSet implements RowFilterInterface {
if (operator == Operator.MUST_PASS_ALL) {
if (filter.filterAllRemaining() ||
filter.filterColumn(rowKey, colKey, data)) {
if (LOG.isDebugEnabled()) {
LOG.debug("op.MPALL filter(Text, Text, byte[]) will" +
" return true due to subfilter of type " +
filter.getClass().getSimpleName());
}
result = true;
resultFound = true;
}
} else if (operator == Operator.MUST_PASS_ONE) {
if (!filter.filterAllRemaining() &&
!filter.filterColumn(rowKey, colKey, data)) {
if (LOG.isDebugEnabled()) {
LOG.debug("op.MPONE filter(Text, Text, byte[]) will" +
" return false due to subfilter of type " +
filter.getClass().getSimpleName());
}
result = false;
resultFound = true;
}
@ -228,9 +176,6 @@ public class RowFilterSet implements RowFilterInterface {
filter.filterColumn(rowKey, colKey, data);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("filter(Text, Text, byte[]) returning " + result);
}
return result;
}
@ -242,19 +187,11 @@ public class RowFilterSet implements RowFilterInterface {
if (!resultFound) {
if (operator == Operator.MUST_PASS_ALL) {
if (filter.filterAllRemaining() || filter.filterRow(columns)) {
if (LOG.isDebugEnabled()) {
LOG.debug("op.MPALL filterNotNull will return true due" +
" to subfilter of type " + filter.getClass().getSimpleName());
}
result = true;
resultFound = true;
}
} else if (operator == Operator.MUST_PASS_ONE) {
if (!filter.filterAllRemaining() && !filter.filterRow(columns)) {
if (LOG.isDebugEnabled()) {
LOG.debug("op.MPONE filterNotNull will return false due" +
" to subfilter of type " + filter.getClass().getSimpleName());
}
result = false;
resultFound = true;
}
@ -263,9 +200,6 @@ public class RowFilterSet implements RowFilterInterface {
filter.filterRow(columns);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("filterNotNull returning " + result);
}
return result;
}
@ -281,10 +215,6 @@ public class RowFilterSet implements RowFilterInterface {
RowFilterInterface filter = (RowFilterInterface) ObjectWritable
.readObject(in, conf);
filters.add(filter);
if (LOG.isDebugEnabled()) {
LOG.debug("Successfully read in subfilter of type "
+ filter.getClass().getSimpleName());
}
}
}
}

View File

@ -24,8 +24,6 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.SortedMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.Text;
/**
@ -36,8 +34,6 @@ public class StopRowFilter implements RowFilterInterface {
protected Text stopRowKey;
static final Log LOG = LogFactory.getLog(StopRowFilter.class);
/**
* Default constructor, filters nothing. Required though for RPC
* deserialization.
@ -104,12 +100,7 @@ public class StopRowFilter implements RowFilterInterface {
}
return false;
}
boolean result = this.stopRowKey.compareTo(rowKey) <= 0;
if (LOG.isDebugEnabled()) {
LOG.debug("Filter result for rowKey: " + rowKey + ". Result: " +
result);
}
return result;
return this.stopRowKey.compareTo(rowKey) <= 0;
}
/**

View File

@ -24,8 +24,6 @@ import java.io.DataOutput;
import java.io.IOException;
import java.util.SortedMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.Text;
/**
@ -40,8 +38,6 @@ public class WhileMatchRowFilter implements RowFilterInterface {
private boolean filterAllRemaining = false;
private RowFilterInterface filter;
static final Log LOG = LogFactory.getLog(WhileMatchRowFilter.class);
/**
* Default constructor, filters nothing. Required though for RPC
* deserialization.
@ -69,9 +65,6 @@ public class WhileMatchRowFilter implements RowFilterInterface {
/** {@inheritDoc} */
public void reset() {
if (LOG.isDebugEnabled()) {
LOG.debug("Resetting.");
}
this.filterAllRemaining = false;
this.filter.reset();
}
@ -95,34 +88,20 @@ public class WhileMatchRowFilter implements RowFilterInterface {
/** {@inheritDoc} */
public boolean filterRowKey(final Text rowKey) {
changeFAR(this.filter.filterRowKey(rowKey));
boolean result = filterAllRemaining();
if (LOG.isDebugEnabled()) {
LOG.debug("Filter on rowKey:" + rowKey + ". Result = " + result);
}
return result;
return filterAllRemaining();
}
/** {@inheritDoc} */
public boolean filterColumn(final Text rowKey, final Text colKey,
final byte[] data) {
changeFAR(this.filter.filterColumn(rowKey, colKey, data));
boolean result = filterAllRemaining();
if (LOG.isDebugEnabled()) {
LOG.debug("Filter on rowKey:" + rowKey + ", colKey: " + colKey +
", data: " + data + ". Result = " + result);
}
return result;
return filterAllRemaining();
}
/** {@inheritDoc} */
public boolean filterRow(final SortedMap<Text, byte[]> columns) {
changeFAR(this.filter.filterRow(columns));
boolean result = filterAllRemaining();
if (LOG.isDebugEnabled()) {
LOG.debug("FilterNotNull on cols:" + columns + ". Result = " +
result);
}
return result;
return filterAllRemaining();
}
/**
@ -133,10 +112,6 @@ public class WhileMatchRowFilter implements RowFilterInterface {
*/
private void changeFAR(boolean value) {
this.filterAllRemaining = this.filterAllRemaining || value;
if (LOG.isDebugEnabled()) {
LOG.debug("this.filterAllRemaining is now: " +
this.filterAllRemaining);
}
}
/** {@inheritDoc} */
@ -157,10 +132,6 @@ public class WhileMatchRowFilter implements RowFilterInterface {
this.filter = (RowFilterInterface)(Class.forName(className).
newInstance());
this.filter.readFields(in);
if (LOG.isDebugEnabled()) {
LOG.debug("Successfully read a sub-filter of type: " +
className);
}
} catch (InstantiationException e) {
throw new RuntimeException("Failed to deserialize WhileMatchRowFilter.",
e);