HBASE-15410 (addendum) Utilize the max seek value when all Filters in MUST_PASS_ALL FilterList return SEEK_NEXT_USING_HINT

This commit is contained in:
huzheng 2017-10-26 18:40:05 +08:00
parent 1b70751c9c
commit a93e1aa8f6
1 changed files with 7 additions and 8 deletions

View File

@ -23,9 +23,8 @@ import org.apache.hadoop.hbase.Cell;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
import java.io.IOException; import java.io.IOException;
import java.util.HashSet; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* FilterListWithAND represents an ordered list of filters which will be evaluated with an AND * FilterListWithAND represents an ordered list of filters which will be evaluated with an AND
@ -34,7 +33,7 @@ import java.util.Set;
@InterfaceAudience.Private @InterfaceAudience.Private
public class FilterListWithAND extends FilterListBase { public class FilterListWithAND extends FilterListBase {
private Set<Filter> seekHintFilter = new HashSet<>(); private List<Filter> seekHintFilters = new ArrayList<>();
public FilterListWithAND(List<Filter> filters) { public FilterListWithAND(List<Filter> filters) {
super(filters); super(filters);
@ -155,7 +154,7 @@ public class FilterListWithAND extends FilterListBase {
ReturnCode rc = ReturnCode.INCLUDE; ReturnCode rc = ReturnCode.INCLUDE;
Cell transformed = transformedCell; Cell transformed = transformedCell;
this.referenceCell = c; this.referenceCell = c;
this.seekHintFilter.clear(); this.seekHintFilters.clear();
for (int i = 0, n = filters.size(); i < n; i++) { for (int i = 0, n = filters.size(); i < n; i++) {
Filter filter = filters.get(i); Filter filter = filters.get(i);
if (filter.filterAllRemaining()) { if (filter.filterAllRemaining()) {
@ -175,11 +174,11 @@ public class FilterListWithAND extends FilterListBase {
transformed = filter.transformCell(transformed); transformed = filter.transformCell(transformed);
} }
if (localRC == ReturnCode.SEEK_NEXT_USING_HINT) { if (localRC == ReturnCode.SEEK_NEXT_USING_HINT) {
seekHintFilter.add(filter); seekHintFilters.add(filter);
} }
} }
this.transformedCell = transformed; this.transformedCell = transformed;
if (!seekHintFilter.isEmpty()) { if (!seekHintFilters.isEmpty()) {
return ReturnCode.SEEK_NEXT_USING_HINT; return ReturnCode.SEEK_NEXT_USING_HINT;
} }
return rc; return rc;
@ -190,7 +189,7 @@ public class FilterListWithAND extends FilterListBase {
for (int i = 0, n = filters.size(); i < n; i++) { for (int i = 0, n = filters.size(); i < n; i++) {
filters.get(i).reset(); filters.get(i).reset();
} }
seekHintFilter.clear(); seekHintFilters.clear();
} }
@Override @Override
@ -259,7 +258,7 @@ public class FilterListWithAND extends FilterListBase {
return super.getNextCellHint(currentCell); return super.getNextCellHint(currentCell);
} }
Cell maxHint = null; Cell maxHint = null;
for (Filter filter : seekHintFilter) { for (Filter filter : seekHintFilters) {
if (filter.filterAllRemaining()) { if (filter.filterAllRemaining()) {
continue; continue;
} }