diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 7ce93bd..355a191 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -3905,10 +3905,12 @@ public class HRegion implements HeapSize { // , Writable{ if (filter != null && filter.hasFilterRow()) { filter.filterRowCells(results); } - if (isEmptyRow) { + + if (isEmptyRow || filterRow()) { + results.clear(); boolean moreRows = nextRow(currentRow, offset, length); if (!moreRows) return false; - results.clear(); + // This row was totally filtered out, if this is NOT the last row, // we should continue on. Otherwise, nothing else to do. if (!stopRow) continue; @@ -3958,6 +3960,20 @@ public class HRegion implements HeapSize { // , Writable{ } } + /** + * This function is to maintain backward compatibility for 0.94 filters. HBASE-6429 combines + * both filterRow & filterRow(List kvs) functions. While 0.94 code or older, it may + * not implement hasFilterRow as HBase-6429 expected because hasFilterRow only returns true when + * filterRow(List kvs) is overridden not the filterRow(). Therefore, the filterRow() + * will be skipped. + */ + private boolean filterRow() throws IOException { + // when hasFilterRow returns true, filter.filterRow() will be called automatically inside + // filterRowCells(List kvs) so we skip that scenario here. + return filter != null && (!filter.hasFilterRow()) + && filter.filterRow(); + } + private boolean filterRowKey(byte[] row, int offset, short length) throws IOException { return filter != null && filter.filterRowKey(row, offset, length);