@InterfaceAudience.Private public class SegmentScanner extends Object implements KeyValueScanner
Modifier and Type | Field and Description |
---|---|
protected boolean |
closed |
protected Cell |
current |
private static long |
DEFAULT_SCANNER_ORDER |
protected Iterator<Cell> |
iter |
private Cell |
last |
private long |
readPoint |
private long |
scannerOrder
Order of this scanner relative to other scanners.
|
protected Segment |
segment |
private boolean |
stopSkippingKVsIfNextRow |
private Cell |
stopSkippingKVsRow |
NO_NEXT_INDEXED_KEY
Modifier | Constructor and Description |
---|---|
protected |
SegmentScanner(Segment segment,
long readPoint) |
protected |
SegmentScanner(Segment segment,
long readPoint,
long scannerOrder) |
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()
This function should be never called on scanners that always do real seek operations (i.e.
|
org.apache.hadoop.fs.Path |
getFilePath() |
private Cell |
getHighest(Cell first,
Cell second)
Private internal method that returns the higher of the two key values, or null
if they are both null
|
protected Iterator<Cell> |
getIterator(Cell cell) |
Cell |
getNextIndexedKey() |
long |
getScannerOrder()
Get the order of this KeyValueScanner.
|
private Segment |
getSegment()
Private Methods
|
boolean |
isFileScanner() |
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 the scanner
|
boolean |
realSeekDone()
This scanner is working solely on the in-memory MemStore and doesn't work on
store files, MutableCellSetSegmentScanner always does the seek,
therefore always returning true.
|
boolean |
requestSeek(Cell c,
boolean forward,
boolean useBloom)
Similar to
KeyValueScanner.seek(org.apache.hadoop.hbase.Cell) (or KeyValueScanner.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. |
boolean |
reseek(Cell cell)
Reseek the scanner at or after the specified KeyValue.
|
boolean |
seek(Cell cell)
Seek the scanner at or after the specified Cell.
|
boolean |
seekToLastRow()
Seek the scanner at the first KeyValue of last row
|
boolean |
seekToPreviousRow(Cell cell)
Seek the scanner at the first Cell of the row which is the previous row
of specified key
|
void |
shipped()
Called after a batch of rows scanned (RPC) and set to be returned to client.
|
boolean |
shouldUseScanner(Scan scan,
HStore store,
long oldestUnexpiredTS)
This functionality should be resolved in the higher level which is
MemStoreScanner, currently returns true as default.
|
String |
toString() |
protected void |
updateCurrent()
Private internal method for iterating over the segment,
skipping the cells with irrelevant MVCC
|
private long scannerOrder
KeyValueScanner.getScannerOrder()
.private static final long DEFAULT_SCANNER_ORDER
private long readPoint
private boolean stopSkippingKVsIfNextRow
private Cell stopSkippingKVsRow
protected boolean closed
protected SegmentScanner(Segment segment, long readPoint)
protected SegmentScanner(Segment segment, long readPoint, long scannerOrder)
scannerOrder
- see KeyValueScanner.getScannerOrder()
.
Scanners are ordered from 0 (oldest) to newest in increasing order.public Cell peek()
peek
in interface KeyValueScanner
public Cell next() throws IOException
next
in interface KeyValueScanner
IOException
public boolean seek(Cell cell) throws IOException
seek
in interface KeyValueScanner
cell
- seek valueIOException
protected Iterator<Cell> getIterator(Cell cell)
public boolean reseek(Cell cell) throws IOException
reseek
in interface KeyValueScanner
cell
- seek value (should be non-null)IOException
public boolean backwardSeek(Cell key) throws IOException
backwardSeek
in interface KeyValueScanner
key
- seek CellIOException
public boolean seekToPreviousRow(Cell cell) throws IOException
seekToPreviousRow
in interface KeyValueScanner
cell
- seek valueIOException
public boolean seekToLastRow() throws IOException
seekToLastRow
in interface KeyValueScanner
IOException
public long getScannerOrder()
KeyValueScanner
getScannerOrder
in interface KeyValueScanner
KeyValueScanner.getScannerOrder()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface KeyValueScanner
public boolean shouldUseScanner(Scan scan, HStore store, long oldestUnexpiredTS)
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 requestSeek(Cell c, boolean forward, boolean useBloom) throws IOException
KeyValueScanner
KeyValueScanner.seek(org.apache.hadoop.hbase.Cell)
(or KeyValueScanner.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.requestSeek
in interface KeyValueScanner
forward
- do a forward-only "reseek" instead of a random-access seekuseBloom
- whether to enable multi-column Bloom filter optimizationIOException
public boolean realSeekDone()
realSeekDone
in interface KeyValueScanner
public void enforceSeek() throws IOException
realSeekDone()
first.enforceSeek
in interface KeyValueScanner
IOException
public boolean isFileScanner()
isFileScanner
in interface KeyValueScanner
public org.apache.hadoop.fs.Path getFilePath()
getFilePath
in interface KeyValueScanner
KeyValueScanner.isFileScanner()
public Cell getNextIndexedKey()
getNextIndexedKey
in interface KeyValueScanner
public void shipped() throws IOException
shipped
in interface Shipper
IOException
private Segment getSegment()
protected void updateCurrent()
private Cell getHighest(Cell first, Cell second)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.