Revert "HBASE-15410 Utilize the max seek value when all Filters in MUST_PASS_ALL FilterList return SEEK_NEXT_USING_HINT"

This reverts commit 743f3ae221.

Backing out filterlist regression, see HBASE-18957. Work continuing branch for HBASE-18410.

Signed-off-by: Peter Somogyi <psomogyi@cloudera.com>
Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Sean Busbey 2017-10-06 13:19:22 -05:00
parent 2dcdd13a01
commit 1d07c8eec4
2 changed files with 9 additions and 28 deletions

View File

@ -22,9 +22,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellComparator;
@ -67,7 +65,7 @@ final public class FilterList extends FilterBase {
private static final int MAX_LOG_FILTERS = 5;
private Operator operator = Operator.MUST_PASS_ALL;
private final List<Filter> filters;
private Set<Filter> seekHintFilter = new HashSet<>();
private Filter seekHintFilter = null;
/**
* Save previous return code and previous cell for every filter in filter list. For MUST_PASS_ONE,
@ -236,7 +234,7 @@ final public class FilterList extends FilterBase {
prevCellList.set(i, null);
}
}
seekHintFilter.clear();
seekHintFilter = null;
}
@Override
@ -360,7 +358,6 @@ final public class FilterList extends FilterBase {
return ReturnCode.INCLUDE;
}
this.referenceCell = c;
seekHintFilter.clear();
// Accumulates successive transformation of every filter that includes the Cell:
Cell transformed = c;
@ -392,12 +389,10 @@ final public class FilterList extends FilterBase {
transformed = filter.transformCell(transformed);
continue;
case SEEK_NEXT_USING_HINT:
seekHintFilter.add(filter);
continue;
default:
if (seekHintFilter.isEmpty()) {
seekHintFilter = filter;
return code;
default:
return code;
}
}
} else if (operator == Operator.MUST_PASS_ONE) {
Cell prevCell = this.prevCellList.get(i);
@ -447,10 +442,6 @@ final public class FilterList extends FilterBase {
}
}
if (!seekHintFilter.isEmpty()) {
return ReturnCode.SEEK_NEXT_USING_HINT;
}
// Save the transformed Cell for transform():
this.transformedCell = transformed;
@ -574,17 +565,7 @@ final public class FilterList extends FilterBase {
}
Cell keyHint = null;
if (operator == Operator.MUST_PASS_ALL) {
for (Filter filter : seekHintFilter) {
if (filter.filterAllRemaining()) continue;
Cell curKeyHint = filter.getNextCellHint(currentCell);
if (keyHint == null) {
keyHint = curKeyHint;
continue;
}
if (CellComparator.COMPARATOR.compare(keyHint, curKeyHint) < 0) {
keyHint = curKeyHint;
}
}
if (seekHintFilter != null) keyHint = seekHintFilter.getNextCellHint(currentCell);
return keyHint;
}

View File

@ -526,7 +526,7 @@ public class TestFilterList {
Arrays.asList(new Filter [] { filterMinHint, filterMaxHint } ));
filterList.filterKeyValue(null);
assertEquals(0, CellComparator.COMPARATOR.compare(filterList.getNextCellHint(null),
maxKeyValue));
minKeyValue));
filterList = new FilterList(Operator.MUST_PASS_ALL,
Arrays.asList(new Filter [] { filterMaxHint, filterMinHint } ));
@ -540,7 +540,7 @@ public class TestFilterList {
new Filter [] { filterNoHint, filterMinHint, filterMaxHint } ));
filterList.filterKeyValue(null);
assertEquals(0, CellComparator.COMPARATOR.compare(filterList.getNextCellHint(null),
maxKeyValue));
minKeyValue));
filterList = new FilterList(Operator.MUST_PASS_ALL,
Arrays.asList(new Filter [] { filterNoHint, filterMaxHint } ));
filterList.filterKeyValue(null);