@InterfaceAudience.LimitedPrivate(value="Coprocessor") public class StoreFileScanner extends Object implements KeyValueScanner
Modifier and Type | Field and Description |
---|---|
private boolean |
closed |
private Cell |
cur |
private boolean |
delayedReseek |
private Cell |
delayedSeekKV |
private boolean |
enforceMVCC |
private boolean |
hasMVCCInfo |
private HFileScanner |
hfs |
private static org.apache.commons.logging.Log |
LOG |
private ScanQueryMatcher |
matcher |
private StoreFile.Reader |
reader |
private long |
readPt |
private boolean |
realSeekDone |
private static AtomicLong |
seekCount |
private boolean |
stopSkippingKVsIfNextRow |
NO_NEXT_INDEXED_KEY
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(Cell key)
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
|
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?).
|
(package private) KeyValue.KVComparator |
getComparator() |
Cell |
getNextIndexedKey() |
(package private) StoreFile.Reader |
getReader() |
static List<StoreFileScanner> |
getScannersForStoreFiles(Collection<StoreFile> files,
boolean cacheBlocks,
boolean usePread,
boolean isCompaction,
boolean useDropBehind,
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,
boolean canUseDrop,
ScanQueryMatcher matcher,
long readPt) |
static List<StoreFileScanner> |
getScannersForStoreFiles(Collection<StoreFile> files,
boolean cacheBlocks,
boolean usePread,
boolean isCompaction,
boolean canUseDrop,
ScanQueryMatcher matcher,
long readPt,
boolean isPrimaryReplica)
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.
|
(package private) static long |
getSeekCount() |
long |
getSequenceID()
Get the sequence id associated with this KeyValueScanner.
|
(package private) static void |
instrument() |
boolean |
isFileScanner() |
(package private) boolean |
isPrimaryReplica() |
Cell |
next()
Return the next Cell in this scanner, iterating the scanner
|
Cell |
peek()
Look at the next Cell 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(Cell kv,
boolean forward,
boolean useBloom)
Pretend we have done a seek but don't do it yet, if possible.
|
boolean |
reseek(Cell key)
Reseek the scanner at or after the specified KeyValue.
|
(package private) static boolean |
reseekAtOrAfter(HFileScanner s,
Cell k) |
boolean |
seek(Cell key)
Seek the scanner at or after the specified KeyValue.
|
static boolean |
seekAtOrAfter(HFileScanner s,
Cell k) |
boolean |
seekToLastRow()
Seek the scanner at the first KeyValue of last row
|
boolean |
seekToPreviousRow(Cell originalKey)
Seek the scanner at the first Cell of the row which is the previous row
of specified key
|
protected void |
setCurrentCell(Cell newVal) |
void |
setScanQueryMatcher(ScanQueryMatcher matcher) |
boolean |
shouldUseScanner(Scan scan,
Store 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.
|
protected boolean |
skipKVsNewerThanReadpoint() |
String |
toString() |
private static final org.apache.commons.logging.Log LOG
private final StoreFile.Reader reader
private final HFileScanner hfs
private Cell cur
private boolean closed
private boolean realSeekDone
private boolean delayedReseek
private Cell delayedSeekKV
private boolean enforceMVCC
private boolean hasMVCCInfo
private boolean stopSkippingKVsIfNextRow
private static AtomicLong seekCount
private ScanQueryMatcher matcher
private long readPt
public StoreFileScanner(StoreFile.Reader reader, HFileScanner hfs, boolean useMVCC, boolean hasMVCC, long readPt)
KeyValueScanner
on top of the specified HFileScanner
hfs
- HFile scannerboolean isPrimaryReplica()
public static List<StoreFileScanner> getScannersForStoreFiles(Collection<StoreFile> files, boolean cacheBlocks, boolean usePread, long readPt) throws IOException
IOException
public static List<StoreFileScanner> getScannersForStoreFiles(Collection<StoreFile> files, boolean cacheBlocks, boolean usePread, boolean isCompaction, boolean useDropBehind, long readPt) throws IOException
IOException
public static List<StoreFileScanner> getScannersForStoreFiles(Collection<StoreFile> files, boolean cacheBlocks, boolean usePread, boolean isCompaction, boolean canUseDrop, ScanQueryMatcher matcher, long readPt, boolean isPrimaryReplica) throws IOException
IOException
public static List<StoreFileScanner> getScannersForStoreFiles(Collection<StoreFile> files, boolean cacheBlocks, boolean usePread, boolean isCompaction, boolean canUseDrop, ScanQueryMatcher matcher, long readPt) throws IOException
IOException
public Cell peek()
KeyValueScanner
peek
in interface KeyValueScanner
public Cell next() throws IOException
KeyValueScanner
next
in interface KeyValueScanner
IOException
public boolean seek(Cell key) throws IOException
KeyValueScanner
seek
in interface KeyValueScanner
key
- seek valueIOException
public boolean reseek(Cell key) throws IOException
KeyValueScanner
reseek
in interface KeyValueScanner
key
- seek value (should be non-null)IOException
protected void setCurrentCell(Cell newVal) throws IOException
IOException
protected boolean skipKVsNewerThanReadpoint() throws IOException
IOException
public void close()
KeyValueScanner
close
in interface KeyValueScanner
public static boolean seekAtOrAfter(HFileScanner s, Cell k) throws IOException
s
- k
- IOException
static boolean reseekAtOrAfter(HFileScanner s, Cell k) throws IOException
IOException
public long getSequenceID()
KeyValueScanner
getSequenceID
in interface KeyValueScanner
public boolean requestSeek(Cell 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 KeyValueScanner
forward
- do a forward-only "reseek" instead of a random-access seekuseBloom
- whether to enable multi-column Bloom filter optimizationIOException
StoreFile.Reader getReader()
KeyValue.KVComparator getComparator()
public boolean realSeekDone()
KeyValueScanner
realSeekDone
in interface KeyValueScanner
public void enforceSeek() throws IOException
KeyValueScanner
KeyValueScanner.realSeekDone()
first.enforceSeek
in interface KeyValueScanner
IOException
public void setScanQueryMatcher(ScanQueryMatcher matcher)
public boolean isFileScanner()
isFileScanner
in interface KeyValueScanner
static final long getSeekCount()
static final void instrument()
public boolean shouldUseScanner(Scan scan, Store store, long oldestUnexpiredTS)
KeyValueScanner
shouldUseScanner
in interface KeyValueScanner
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 TTLpublic boolean seekToPreviousRow(Cell originalKey) throws IOException
KeyValueScanner
seekToPreviousRow
in interface KeyValueScanner
originalKey
- seek valueIOException
public boolean seekToLastRow() throws IOException
KeyValueScanner
seekToLastRow
in interface KeyValueScanner
IOException
public boolean backwardSeek(Cell key) throws IOException
KeyValueScanner
backwardSeek
in interface KeyValueScanner
key
- seek KeyValueIOException
public Cell getNextIndexedKey()
getNextIndexedKey
in interface KeyValueScanner
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.