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
Nested ClassesModifier and TypeClassDescriptionprivate static classIn 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, scannersForDelayedCloseFields inherited from interface org.apache.hadoop.hbase.regionserver.KeyValueScanner
NO_NEXT_INDEXED_KEY -
Constructor Summary
ConstructorsConstructorDescriptionReversedKeyValueHeap(List<? extends KeyValueScanner> scanners, CellComparator comparator) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbackwardSeek(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 scannerbooleanrequestSeek(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.booleanThis function is identical to theKeyValueHeap.seek(Cell)function except that scanner.seek(seekKey) is changed to scanner.reseek(seekKey).booleanSeeks all scanners at or below the specified seek key.booleanSeek the scanner at the first KeyValue of last rowbooleanseekToPreviousRow(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, shippedMethods inherited from class org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
doRealSeek, enforceSeek, getFilePath, isFileScanner, realSeekDone, shouldUseScannerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.regionserver.InternalScanner
nextMethods 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:KeyValueHeapSeeks 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:
seekin interfaceKeyValueScanner- Overrides:
seekin 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:KeyValueHeapThis function is identical to theKeyValueHeap.seek(Cell)function except that scanner.seek(seekKey) is changed to scanner.reseek(seekKey).- Specified by:
reseekin interfaceKeyValueScanner- Overrides:
reseekin 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:KeyValueHeapSimilar 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:
requestSeekin interfaceKeyValueScanner- Overrides:
requestSeekin classKeyValueHeapforward- 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:KeyValueScannerSeek the scanner at the first Cell of the row which is the previous row of specified key- Specified by:
seekToPreviousRowin interfaceKeyValueScanner- Overrides:
seekToPreviousRowin 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:KeyValueScannerSeek 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:
backwardSeekin interfaceKeyValueScanner- Overrides:
backwardSeekin 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:KeyValueScannerReturn the next Cell in this scanner, iterating the scanner- Specified by:
nextin interfaceKeyValueScanner- Overrides:
nextin classKeyValueHeap- Returns:
- the next Cell
- Throws:
IOException
-
seekToLastRow
Description copied from interface:KeyValueScannerSeek the scanner at the first KeyValue of last row- Specified by:
seekToLastRowin interfaceKeyValueScanner- Overrides:
seekToLastRowin classNonReversedNonLazyKeyValueScanner- Returns:
- true if scanner has values left, false if the underlying data is empty
- Throws:
IOException
-