Class NonLazyKeyValueScanner
java.lang.Object
org.apache.hadoop.hbase.regionserver.NonLazyKeyValueScanner
- All Implemented Interfaces:
Closeable
,AutoCloseable
,KeyValueScanner
,Shipper
- Direct Known Subclasses:
NonReversedNonLazyKeyValueScanner
A "non-lazy" scanner which always does a real seek operation. Most scanners are inherited from
this class.
-
Field Summary
Fields inherited from interface org.apache.hadoop.hbase.regionserver.KeyValueScanner
NO_NEXT_INDEXED_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
doRealSeek
(KeyValueScanner scanner, Cell kv, boolean forward) void
Does the real seek operation in case it was skipped by seekToRowCol(KeyValue, boolean) (TODO: Whats this?).org.apache.hadoop.fs.Path
boolean
Returns true if this is a file scanner.boolean
We optimize our store scanners by checking the most recent store file first, so we sometimes pretend we have done a seek but delay it until the store scanner bubbles up to the top of the key-value heap.void
recordBlockSize
(IntConsumer blockSizeConsumer) Record the size of the current block in bytes, passing as an argument to the blockSizeConsumer.boolean
requestSeek
(Cell kv, 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.void
shipped()
Called after a batch of rows scanned and set to be returned to client.boolean
shouldUseScanner
(Scan scan, HStore store, long oldestUnexpiredTS) Allows to filter out scanners (both StoreFile and memstore) that we don't want to use based on criteria such as Bloom filters and timestamp ranges.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.KeyValueScanner
backwardSeek, close, getScannerOrder, next, peek, reseek, seek, seekToLastRow, seekToPreviousRow
-
Constructor Details
-
NonLazyKeyValueScanner
public NonLazyKeyValueScanner()
-
-
Method Details
-
requestSeek
Description copied from interface:KeyValueScanner
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
forward
- do a forward-only "reseek" instead of a random-access seekuseBloom
- whether to enable multi-column Bloom filter optimization- Throws:
IOException
-
realSeekDone
Description copied from interface:KeyValueScanner
We optimize our store scanners by checking the most recent store file first, so we sometimes pretend we have done a seek but delay it until the store scanner bubbles up to the top of the key-value heap. This method is then used to ensure the top store file scanner has done a seek operation.- Specified by:
realSeekDone
in interfaceKeyValueScanner
-
enforceSeek
Description copied from interface:KeyValueScanner
Does the real seek operation in case it was skipped by seekToRowCol(KeyValue, boolean) (TODO: Whats this?). Note that this function should be never called on scanners that always do real seek operations (i.e. most of the scanners). The easiest way to achieve this is to callKeyValueScanner.realSeekDone()
first.- Specified by:
enforceSeek
in interfaceKeyValueScanner
- Throws:
IOException
-
doRealSeek
public static boolean doRealSeek(KeyValueScanner scanner, Cell kv, boolean forward) throws IOException - Throws:
IOException
-
shouldUseScanner
Description copied from interface:KeyValueScanner
Allows to filter out scanners (both StoreFile and memstore) that we don't want to use based on criteria such as Bloom filters and timestamp ranges.- Specified by:
shouldUseScanner
in interfaceKeyValueScanner
- Parameters:
scan
- the scan that we are selecting scanners forstore
- the store we are performing the scan on.oldestUnexpiredTS
- the oldest timestamp we are interested in for this query, based on TTL- Returns:
- true if the scanner should be included in the query
-
isFileScanner
Description copied from interface:KeyValueScanner
Returns true if this is a file scanner. Otherwise a memory scanner is assumed.- Specified by:
isFileScanner
in interfaceKeyValueScanner
-
recordBlockSize
Description copied from interface:KeyValueScanner
Record the size of the current block in bytes, passing as an argument to the blockSizeConsumer. Implementations should ensure that blockSizeConsumer is only called once per block.- Specified by:
recordBlockSize
in interfaceKeyValueScanner
- Parameters:
blockSizeConsumer
- to be called with block size in bytes, once per block.
-
getFilePath
- Specified by:
getFilePath
in interfaceKeyValueScanner
- Returns:
- the file path if this is a file scanner, otherwise null.
- See Also:
-
getNextIndexedKey
- Specified by:
getNextIndexedKey
in interfaceKeyValueScanner
- Returns:
- the next key in the index, usually the first key of next block OR a key that falls between last key of current block and first key of next block.. see HFileWriterImpl#getMidpoint, or null if not known.
-
shipped
Description copied from interface:Shipper
Called after a batch of rows scanned and set to be returned to client. Any in between cleanup can be done here.- Specified by:
shipped
in interfaceShipper
- Throws:
IOException
-