HBASE-14206 MultiRowRangeFilter returns records whose rowKeys are out of allowed ranges (Anton Nazaruk)
This commit is contained in:
parent
c07eb21e4b
commit
90b8cc89bd
|
@ -233,6 +233,9 @@ public class MultiRowRangeFilter extends FilterBase {
|
||||||
if (insertionPosition == 0 && !rangeList.get(insertionPosition).contains(rowKey)) {
|
if (insertionPosition == 0 && !rangeList.get(insertionPosition).contains(rowKey)) {
|
||||||
return ROW_BEFORE_FIRST_RANGE;
|
return ROW_BEFORE_FIRST_RANGE;
|
||||||
}
|
}
|
||||||
|
if (!initialized) {
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
return insertionPosition;
|
return insertionPosition;
|
||||||
}
|
}
|
||||||
// the row key equals one of the start keys, and the the range exclude the start key
|
// the row key equals one of the start keys, and the the range exclude the start key
|
||||||
|
|
|
@ -69,6 +69,24 @@ public class TestMultiRowRangeFilter {
|
||||||
TEST_UTIL.shutdownMiniCluster();
|
TEST_UTIL.shutdownMiniCluster();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRanges() throws IOException {
|
||||||
|
byte[] key1Start = new byte[] {-3};
|
||||||
|
byte[] key1End = new byte[] {-2};
|
||||||
|
|
||||||
|
byte[] key2Start = new byte[] {5};
|
||||||
|
byte[] key2End = new byte[] {6};
|
||||||
|
|
||||||
|
byte[] badKey = new byte[] {-10};
|
||||||
|
|
||||||
|
MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
|
||||||
|
new MultiRowRangeFilter.RowRange(key1Start, true, key1End, false),
|
||||||
|
new MultiRowRangeFilter.RowRange(key2Start, true, key2End, false)
|
||||||
|
));
|
||||||
|
filter.filterRowKey(badKey, 0, 1);
|
||||||
|
assertEquals(Filter.ReturnCode.SEEK_NEXT_USING_HINT, filter.filterKeyValue(null));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOutOfOrderScannerNextException() throws Exception {
|
public void testOutOfOrderScannerNextException() throws Exception {
|
||||||
MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
|
MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
|
||||||
|
|
Loading…
Reference in New Issue