Class ReversedKeyValueHeap
java.lang.Object
org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
org.apache.hadoop.hbase.regionserver.NonReversedNonLazyKeyValueScanner
org.apache.hadoop.hbase.regionserver.KeyValueHeap
org.apache.hadoop.hbase.regionserver.ReversedKeyValueHeap
- All Implemented Interfaces:
Closeable
,AutoCloseable
,InternalScanner
,KeyValueScanner
,Shipper
ReversedKeyValueHeap is used for supporting reversed scanning. Compared with KeyValueHeap, its
scanner comparator is a little different (see ReversedKVScannerComparator), all seek is backward
seek(see
KeyValueScanner.backwardSeek(org.apache.hadoop.hbase.Cell)
), and it will jump to the previous row if it is
already at the end of one row when calling next().-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
In ReversedKVScannerComparator, we compare the row of scanners' peek values first, sort bigger one before the smaller one.Nested classes/interfaces inherited from class org.apache.hadoop.hbase.regionserver.KeyValueHeap
KeyValueHeap.KVScannerComparator
-
Field Summary
Fields inherited from class org.apache.hadoop.hbase.regionserver.KeyValueHeap
comparator, current, heap, scannersForDelayedClose
Fields inherited from interface org.apache.hadoop.hbase.regionserver.KeyValueScanner
NO_NEXT_INDEXED_KEY
-
Constructor Summary
ConstructorDescriptionReversedKeyValueHeap
(List<? extends KeyValueScanner> scanners, CellComparator comparator) -
Method Summary
Modifier and TypeMethodDescriptionboolean
backwardSeek
(Cell seekKey) Seek the scanner at or before the row of specified Cell, it firstly tries to seek the scanner at or after the specified Cell, return if peek KeyValue of scanner has the same row with specified Cell, otherwise seek the scanner at the first Cell of the row which is the previous row of specified KeyValuenext()
Return the next Cell in this scanner, iterating the scannerboolean
requestSeek
(Cell key, boolean forward, boolean useBloom) Similar toKeyValueScanner.seek(org.apache.hadoop.hbase.Cell)
(orKeyValueScanner.reseek(org.apache.hadoop.hbase.Cell)
if forward is true) but only does a seek operation after checking that it is really necessary for the row/column combination specified by the kv parameter.boolean
This function is identical to theKeyValueHeap.seek(Cell)
function except that scanner.seek(seekKey) is changed to scanner.reseek(seekKey).boolean
Seeks all scanners at or below the specified seek key.boolean
Seek the scanner at the first KeyValue of last rowboolean
seekToPreviousRow
(Cell seekKey) Seek the scanner at the first Cell of the row which is the previous row of specified keyMethods inherited from class org.apache.hadoop.hbase.regionserver.KeyValueHeap
close, getCurrentForTesting, getHeap, getNextIndexedKey, isLatestCellFromMemstore, next, peek, pollRealKV, recordBlockSize, shipped
Methods inherited from class org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
doRealSeek, enforceSeek, getFilePath, isFileScanner, realSeekDone, shouldUseScanner
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.regionserver.InternalScanner
next
Methods inherited from interface org.apache.hadoop.hbase.regionserver.KeyValueScanner
enforceSeek, getFilePath, getScannerOrder, isFileScanner, realSeekDone, shouldUseScanner
-
Constructor Details
-
ReversedKeyValueHeap
public ReversedKeyValueHeap(List<? extends KeyValueScanner> scanners, CellComparator comparator) throws IOException - Throws:
IOException
-
-
Method Details
-
seek
Description copied from class:KeyValueHeap
Seeks all scanners at or below the specified seek key. If we earlied-out of a row, we may end up skipping values that were never reached yet. Rather than iterating down, we want to give the opportunity to re-seek.As individual scanners may run past their ends, those scanners are automatically closed and removed from the heap.
This function (and
KeyValueHeap.reseek(Cell)
) does not do multi-column Bloom filter and lazy-seek optimizations. To enable those, callKeyValueHeap.requestSeek(Cell, boolean, boolean)
.- Specified by:
seek
in interfaceKeyValueScanner
- Overrides:
seek
in classKeyValueHeap
- Parameters:
seekKey
- KeyValue to seek at or after- Returns:
- true if KeyValues exist at or after specified key, false if not
- Throws:
IOException
-
reseek
Description copied from class:KeyValueHeap
This function is identical to theKeyValueHeap.seek(Cell)
function except that scanner.seek(seekKey) is changed to scanner.reseek(seekKey).- Specified by:
reseek
in interfaceKeyValueScanner
- Overrides:
reseek
in classKeyValueHeap
- Parameters:
seekKey
- seek value (should be non-null)- Returns:
- true if scanner has values left, false if end of scanner
- Throws:
IOException
-
requestSeek
Description copied from class:KeyValueHeap
Similar toKeyValueScanner.seek(org.apache.hadoop.hbase.Cell)
(orKeyValueScanner.reseek(org.apache.hadoop.hbase.Cell)
if forward is true) but only does a seek operation after checking that it is really necessary for the row/column combination specified by the kv parameter. This function was added to avoid unnecessary disk seeks by checking row-column Bloom filters before a seek on multi-column get/scan queries, and to optimize by looking up more recent files first.- Specified by:
requestSeek
in interfaceKeyValueScanner
- Overrides:
requestSeek
in classKeyValueHeap
forward
- do a forward-only "reseek" instead of a random-access seekuseBloom
- whether to enable multi-column Bloom filter optimization- Throws:
IOException
-
seekToPreviousRow
Description copied from interface:KeyValueScanner
Seek the scanner at the first Cell of the row which is the previous row of specified key- Specified by:
seekToPreviousRow
in interfaceKeyValueScanner
- Overrides:
seekToPreviousRow
in classNonReversedNonLazyKeyValueScanner
- Parameters:
seekKey
- seek value- Returns:
- true if the scanner at the first valid Cell of previous row, false if not existing such Cell
- Throws:
IOException
-
backwardSeek
Description copied from interface:KeyValueScanner
Seek the scanner at or before the row of specified Cell, it firstly tries to seek the scanner at or after the specified Cell, return if peek KeyValue of scanner has the same row with specified Cell, otherwise seek the scanner at the first Cell of the row which is the previous row of specified KeyValue- Specified by:
backwardSeek
in interfaceKeyValueScanner
- Overrides:
backwardSeek
in classNonReversedNonLazyKeyValueScanner
- Parameters:
seekKey
- seek KeyValue- Returns:
- true if the scanner is at the valid KeyValue, false if such KeyValue does not exist
- Throws:
IOException
-
next
Description copied from interface:KeyValueScanner
Return the next Cell in this scanner, iterating the scanner- Specified by:
next
in interfaceKeyValueScanner
- Overrides:
next
in classKeyValueHeap
- Returns:
- the next Cell
- Throws:
IOException
-
seekToLastRow
Description copied from interface:KeyValueScanner
Seek the scanner at the first KeyValue of last row- Specified by:
seekToLastRow
in interfaceKeyValueScanner
- Overrides:
seekToLastRow
in classNonReversedNonLazyKeyValueScanner
- Returns:
- true if scanner has values left, false if the underlying data is empty
- Throws:
IOException
-