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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandoRealSeek(KeyValueScanner scanner, Cell kv, boolean forward) voidDoes the real seek operation in case it was skipped by seekToRowCol(KeyValue, boolean) (TODO: Whats this?).org.apache.hadoop.fs.PathbooleanReturns true if this is a file scanner.booleanWe 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.voidrecordBlockSize(IntConsumer blockSizeConsumer) Record the size of the current block in bytes, passing as an argument to the blockSizeConsumer.booleanrequestSeek(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.voidshipped()Called after a batch of rows scanned and set to be returned to client.booleanshouldUseScanner(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, waitMethods 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:KeyValueScannerSimilar 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 interfaceKeyValueScannerforward- 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:KeyValueScannerWe 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:
realSeekDonein interfaceKeyValueScanner
-
enforceSeek
Description copied from interface:KeyValueScannerDoes 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:
enforceSeekin interfaceKeyValueScanner- Throws:
IOException
-
doRealSeek
public static boolean doRealSeek(KeyValueScanner scanner, Cell kv, boolean forward) throws IOException - Throws:
IOException
-
shouldUseScanner
Description copied from interface:KeyValueScannerAllows 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:
shouldUseScannerin 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:KeyValueScannerReturns true if this is a file scanner. Otherwise a memory scanner is assumed.- Specified by:
isFileScannerin interfaceKeyValueScanner
-
recordBlockSize
Description copied from interface:KeyValueScannerRecord 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:
recordBlockSizein interfaceKeyValueScanner- Parameters:
blockSizeConsumer- to be called with block size in bytes, once per block.
-
getFilePath
- Specified by:
getFilePathin interfaceKeyValueScanner- Returns:
- the file path if this is a file scanner, otherwise null.
- See Also:
-
getNextIndexedKey
- Specified by:
getNextIndexedKeyin 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:ShipperCalled after a batch of rows scanned and set to be returned to client. Any in between cleanup can be done here.- Specified by:
shippedin interfaceShipper- Throws:
IOException
-