HBASE-13704 Hbase throws OutOfOrderScannerNextException when MultiRowRangeFilter is used (Aleksandr Maksymenko)
This commit is contained in:
parent
2a1fab0200
commit
181ec60510
|
@ -115,7 +115,9 @@ public class MultiRowRangeFilter extends FilterBase {
|
|||
}
|
||||
initialized = true;
|
||||
} else {
|
||||
currentReturnCode = ReturnCode.SEEK_NEXT_USING_HINT;
|
||||
if (range.contains(buffer, offset, length)) {
|
||||
currentReturnCode = ReturnCode.INCLUDE;
|
||||
} else currentReturnCode = ReturnCode.SEEK_NEXT_USING_HINT;
|
||||
}
|
||||
} else {
|
||||
currentReturnCode = ReturnCode.INCLUDE;
|
||||
|
|
|
@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -68,6 +69,24 @@ public class TestMultiRowRangeFilter {
|
|||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOutOfOrderScannerNextException() throws Exception {
|
||||
MultiRowRangeFilter filter = new MultiRowRangeFilter(Arrays.asList(
|
||||
new MultiRowRangeFilter.RowRange(Bytes.toBytes("b"), true, Bytes.toBytes("c"), true),
|
||||
new MultiRowRangeFilter.RowRange(Bytes.toBytes("d"), true, Bytes.toBytes("e"), true)
|
||||
));
|
||||
filter.filterRowKey(Bytes.toBytes("a"), 0, 1);
|
||||
assertEquals(Filter.ReturnCode.SEEK_NEXT_USING_HINT, filter.filterKeyValue(null));
|
||||
filter.filterRowKey(Bytes.toBytes("b"), 0, 1);
|
||||
assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
|
||||
filter.filterRowKey(Bytes.toBytes("c"), 0, 1);
|
||||
assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
|
||||
filter.filterRowKey(Bytes.toBytes("d"), 0, 1);
|
||||
assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
|
||||
filter.filterRowKey(Bytes.toBytes("e"), 0, 1);
|
||||
assertEquals(Filter.ReturnCode.INCLUDE, filter.filterKeyValue(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMergeAndSortWithEmptyStartRow() throws IOException {
|
||||
List<RowRange> ranges = new ArrayList<RowRange>();
|
||||
|
|
Loading…
Reference in New Issue