@InterfaceAudience.LimitedPrivate(value="Coprocessor") public class StoreFileScanner extends Object implements KeyValueScanner
| Constructor and Description |
|---|
StoreFileScanner(StoreFile.Reader reader,
HFileScanner hfs,
boolean useMVCC,
boolean hasMVCC,
long readPt)
Implements a
KeyValueScanner on top of the specified HFileScanner |
| Modifier and Type | Method and Description |
|---|---|
boolean |
backwardSeek(KeyValue key)
Seek the scanner at or before the row of specified KeyValue, it firstly
tries to seek the scanner at or after the specified KeyValue, return if
peek KeyValue of scanner has the same row with specified KeyValue,
otherwise seek the scanner at the first KeyValue of the row which is the
previous row of specified KeyValue
|
void |
close()
Close the KeyValue scanner.
|
void |
enforceSeek()
Does the real seek operation in case it was skipped by
seekToRowCol(KeyValue, boolean) (TODO: Whats this?).
|
static List<StoreFileScanner> |
getScannersForStoreFiles(Collection<StoreFile> files,
boolean cacheBlocks,
boolean usePread,
boolean isCompaction,
long readPt)
Return an array of scanners corresponding to the given set of store files.
|
static List<StoreFileScanner> |
getScannersForStoreFiles(Collection<StoreFile> files,
boolean cacheBlocks,
boolean usePread,
boolean isCompaction,
ScanQueryMatcher matcher,
long readPt)
Return an array of scanners corresponding to the given set of store files,
And set the ScanQueryMatcher for each store file scanner for further
optimization
|
static List<StoreFileScanner> |
getScannersForStoreFiles(Collection<StoreFile> files,
boolean cacheBlocks,
boolean usePread,
long readPt)
Return an array of scanners corresponding to the given
set of store files.
|
long |
getSequenceID()
Get the sequence id associated with this KeyValueScanner.
|
boolean |
isFileScanner() |
KeyValue |
next()
Return the next KeyValue in this scanner, iterating the scanner
|
KeyValue |
peek()
Look at the next KeyValue in this scanner, but do not iterate scanner.
|
boolean |
realSeekDone()
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.
|
boolean |
requestSeek(KeyValue kv,
boolean forward,
boolean useBloom)
Pretend we have done a seek but don't do it yet, if possible.
|
boolean |
reseek(KeyValue key)
Reseek the scanner at or after the specified KeyValue.
|
boolean |
seek(KeyValue key)
Seek the scanner at or after the specified KeyValue.
|
static boolean |
seekAtOrAfter(HFileScanner s,
KeyValue k) |
boolean |
seekToLastRow()
Seek the scanner at the first KeyValue of last row
|
boolean |
seekToPreviousRow(KeyValue key)
Seek the scanner at the first KeyValue of the row which is the previous row
of specified key
|
void |
setScanQueryMatcher(ScanQueryMatcher matcher) |
boolean |
shouldUseScanner(Scan scan,
SortedSet<byte[]> columns,
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.
|
protected boolean |
skipKVsNewerThanReadpoint() |
String |
toString() |
public StoreFileScanner(StoreFile.Reader reader, HFileScanner hfs, boolean useMVCC, boolean hasMVCC, long readPt)
KeyValueScanner on top of the specified HFileScannerhfs - HFile scannerpublic static List<StoreFileScanner> getScannersForStoreFiles(Collection<StoreFile> files, boolean cacheBlocks, boolean usePread, long readPt) throws IOException
IOExceptionpublic static List<StoreFileScanner> getScannersForStoreFiles(Collection<StoreFile> files, boolean cacheBlocks, boolean usePread, boolean isCompaction, long readPt) throws IOException
IOExceptionpublic static List<StoreFileScanner> getScannersForStoreFiles(Collection<StoreFile> files, boolean cacheBlocks, boolean usePread, boolean isCompaction, ScanQueryMatcher matcher, long readPt) throws IOException
IOExceptionpublic KeyValue peek()
KeyValueScannerpeek in interface KeyValueScannerpublic KeyValue next() throws IOException
KeyValueScannernext in interface KeyValueScannerIOExceptionpublic boolean seek(KeyValue key) throws IOException
KeyValueScannerseek in interface KeyValueScannerkey - seek valueIOExceptionpublic boolean reseek(KeyValue key) throws IOException
KeyValueScannerreseek in interface KeyValueScannerkey - seek value (should be non-null)IOExceptionprotected boolean skipKVsNewerThanReadpoint()
throws IOException
IOExceptionpublic void close()
KeyValueScannerclose in interface KeyValueScannerpublic static boolean seekAtOrAfter(HFileScanner s, KeyValue k) throws IOException
s - k - IOExceptionpublic long getSequenceID()
KeyValueScannergetSequenceID in interface KeyValueScannerpublic boolean requestSeek(KeyValue kv, boolean forward, boolean useBloom) throws IOException
enforceSeek().
Note that this function does guarantee that the current KV of this scanner will be advanced to at least the given KV. Because of this, it does have to do a real seek in cases when the seek timestamp is older than the highest timestamp of the file, e.g. when we are trying to seek to the next row/column and use OLDEST_TIMESTAMP in the seek key.
requestSeek in interface KeyValueScannerforward - do a forward-only "reseek" instead of a random-access seekuseBloom - whether to enable multi-column Bloom filter optimizationIOExceptionpublic boolean realSeekDone()
KeyValueScannerrealSeekDone in interface KeyValueScannerpublic void enforceSeek()
throws IOException
KeyValueScannerKeyValueScanner.realSeekDone() first.enforceSeek in interface KeyValueScannerIOExceptionpublic void setScanQueryMatcher(ScanQueryMatcher matcher)
public boolean isFileScanner()
isFileScanner in interface KeyValueScannerpublic boolean shouldUseScanner(Scan scan, SortedSet<byte[]> columns, long oldestUnexpiredTS)
KeyValueScannershouldUseScanner in interface KeyValueScannerscan - the scan that we are selecting scanners forcolumns - the set of columns in the current column family, or null if
not specified by the scanoldestUnexpiredTS - the oldest timestamp we are interested in for
this query, based on TTLpublic boolean seekToPreviousRow(KeyValue key) throws IOException
KeyValueScannerseekToPreviousRow in interface KeyValueScannerkey - seek valueIOExceptionpublic boolean seekToLastRow()
throws IOException
KeyValueScannerseekToLastRow in interface KeyValueScannerIOExceptionpublic boolean backwardSeek(KeyValue key) throws IOException
KeyValueScannerbackwardSeek in interface KeyValueScannerkey - seek KeyValueIOExceptionCopyright © 2014 The Apache Software Foundation. All rights reserved.