Skip to content

Commit 80044c2

Browse files
committed
handle scan with filter
1 parent fbf042e commit 80044c2

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/NormalUserScanQueryMatcher.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ private MatchCode checkDeletedEffectively(ExtendedCell cell, ExtendedCell prevCe
129129

130130
private boolean canOptimizeReadDeleteMarkers(boolean visibilityLabelEnabled) {
131131
// for simplicity, optimization works only for these cases
132-
return !seePastDeleteMarkers && scanMaxVersions == 1 && !visibilityLabelEnabled;
132+
return !seePastDeleteMarkers && scanMaxVersions == 1 && !visibilityLabelEnabled
133+
&& getFilter() == null;
133134
}
134135

135136
@Override

hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestUserScanQueryMatcherDeleteMarkerOptimization.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.apache.hadoop.hbase.KeepDeletedCells;
3333
import org.apache.hadoop.hbase.KeyValue;
3434
import org.apache.hadoop.hbase.KeyValue.Type;
35+
import org.apache.hadoop.hbase.filter.FilterList;
3536
import org.apache.hadoop.hbase.regionserver.ScanInfo;
3637
import org.apache.hadoop.hbase.regionserver.querymatcher.ScanQueryMatcher.MatchCode;
3738
import org.apache.hadoop.hbase.security.visibility.VisibilityUtils;
@@ -268,4 +269,12 @@ public void testDeleteFamilyWithVisibilityLabelEnabled() throws IOException {
268269
pairs.add(new Pair<>(createKV(col1, 1, Type.Put), MatchCode.SEEK_NEXT_COL));
269270
verify(pairs, 1, VisibilityUtils.isVisibilityLabelEnabled(conf));
270271
}
272+
273+
@Test
274+
public void testScanWithFilter() throws IOException {
275+
scan.setFilter(new FilterList());
276+
pairs.add(new Pair<>(createKV(null, 2, Type.DeleteFamily), MatchCode.SKIP));
277+
pairs.add(new Pair<>(createKV(col1, 1, Type.Put), MatchCode.SEEK_NEXT_COL));
278+
verify(pairs);
279+
}
271280
}

0 commit comments

Comments
 (0)