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

This reverts commit ead1063244.

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 14:04:00 -05:00
parent 8d77c1e954
commit c7dc0da849
2 changed files with 8 additions and 28 deletions

View File

@ -22,15 +22,12 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability; import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValueUtil; import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.exceptions.DeserializationException; import org.apache.hadoop.hbase.exceptions.DeserializationException;
@ -72,7 +69,7 @@ final public class FilterList extends Filter {
private static final int MAX_LOG_FILTERS = 5; private static final int MAX_LOG_FILTERS = 5;
private Operator operator = Operator.MUST_PASS_ALL; private Operator operator = Operator.MUST_PASS_ALL;
private List<Filter> filters = new ArrayList<Filter>(); private List<Filter> filters = new ArrayList<Filter>();
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, * Save previous return code and previous cell for every filter in filter list. For MUST_PASS_ONE,
@ -210,7 +207,7 @@ final public class FilterList extends Filter {
prevCellList.set(i, null); prevCellList.set(i, null);
} }
} }
seekHintFilter.clear(); seekHintFilter = null;
} }
@Override @Override
@ -317,7 +314,6 @@ final public class FilterList extends Filter {
justification="Intentional") justification="Intentional")
public ReturnCode filterKeyValue(Cell v) throws IOException { public ReturnCode filterKeyValue(Cell v) throws IOException {
this.referenceKV = v; this.referenceKV = v;
seekHintFilter.clear();
// Accumulates successive transformation of every filter that includes the Cell: // Accumulates successive transformation of every filter that includes the Cell:
Cell transformed = v; Cell transformed = v;
@ -349,12 +345,10 @@ final public class FilterList extends Filter {
transformed = filter.transformCell(transformed); transformed = filter.transformCell(transformed);
continue; continue;
case SEEK_NEXT_USING_HINT: case SEEK_NEXT_USING_HINT:
seekHintFilter.add(filter); seekHintFilter = filter;
continue; return code;
default: default:
if (seekHintFilter.isEmpty()) {
return code; return code;
}
} }
} else if (operator == Operator.MUST_PASS_ONE) { } else if (operator == Operator.MUST_PASS_ONE) {
Cell prevCell = this.prevCellList.get(i); Cell prevCell = this.prevCellList.get(i);
@ -404,10 +398,6 @@ final public class FilterList extends Filter {
} }
} }
if (!seekHintFilter.isEmpty()) {
return ReturnCode.SEEK_NEXT_USING_HINT;
}
// Save the transformed Cell for transform(): // Save the transformed Cell for transform():
this.transformedKV = transformed; this.transformedKV = transformed;
@ -532,17 +522,7 @@ final public class FilterList extends Filter {
public Cell getNextCellHint(Cell currentKV) throws IOException { public Cell getNextCellHint(Cell currentKV) throws IOException {
Cell keyHint = null; Cell keyHint = null;
if (operator == Operator.MUST_PASS_ALL) { if (operator == Operator.MUST_PASS_ALL) {
for (Filter filter : seekHintFilter) { if (seekHintFilter != null) keyHint = seekHintFilter.getNextCellHint(currentKV);
if (filter.filterAllRemaining()) continue;
Cell curKeyHint = filter.getNextCellHint(currentKV);
if (keyHint == null) {
keyHint = curKeyHint;
continue;
}
if (KeyValue.COMPARATOR.compare(keyHint, curKeyHint) < 0) {
keyHint = curKeyHint;
}
}
return keyHint; return keyHint;
} }

View File

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