class HRegion.RegionScannerImpl extends Object implements RegionScanner, Shipper, RpcCallback
Modifier and Type | Field and Description |
---|---|
protected CellComparator |
comparator |
private ScannerContext |
defaultScannerContext |
private FilterWrapper |
filter |
private boolean |
filterClosed |
protected boolean |
includeStopRow |
protected Cell |
joinedContinuationRow
If the joined heap data gathering is interrupted due to scan limits, this will
contain the row for which we are populating the values.
|
(package private) KeyValueHeap |
joinedHeap
Heap of key-values that are not essential for the provided filters and are thus read
on demand, if on-demand column family loading is enabled.
|
private long |
maxResultSize |
private long |
readPt |
protected HRegion |
region |
protected byte[] |
stopRow |
(package private) KeyValueHeap |
storeHeap |
Constructor and Description |
---|
RegionScannerImpl(Scan scan,
List<KeyValueScanner> additionalScanners,
HRegion region) |
RegionScannerImpl(Scan scan,
List<KeyValueScanner> additionalScanners,
HRegion region,
long nonceGroup,
long nonce) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the scanner and releases any resources it has allocated
|
private boolean |
filterRow()
This function is to maintain backward compatibility for 0.94 filters.
|
private boolean |
filterRowKey(Cell current) |
int |
getBatch() |
long |
getMaxResultSize() |
long |
getMvccReadPoint() |
RegionInfo |
getRegionInfo() |
(package private) KeyValueHeap |
getStoreHeapForTesting() |
private IOException |
handleException(List<KeyValueScanner> instantiatedScanners,
Throwable t) |
protected void |
incrementCountOfRowsFilteredMetric(ScannerContext scannerContext) |
protected void |
incrementCountOfRowsScannedMetric(ScannerContext scannerContext) |
protected void |
initializeKVHeap(List<KeyValueScanner> scanners,
List<KeyValueScanner> joinedScanners,
HRegion region) |
protected void |
initializeScanners(Scan scan,
List<KeyValueScanner> additionalScanners) |
boolean |
isFilterDone() |
private boolean |
isFilterDoneInternal() |
private boolean |
joinedHeapMayHaveData(Cell currentRowCell) |
private boolean |
moreCellsInRow(Cell nextKv,
Cell currentRowCell)
Based on the nextKv in the heap, and the current row, decide whether or not there are more
cells to be read in the heap.
|
boolean |
next(List<Cell> outResults)
Grab the next row's worth of values.
|
boolean |
next(List<Cell> outResults,
ScannerContext scannerContext)
Grab the next row's worth of values.
|
private boolean |
nextInternal(List<Cell> results,
ScannerContext scannerContext) |
boolean |
nextRaw(List<Cell> outResults)
Grab the next row's worth of values.
|
boolean |
nextRaw(List<Cell> outResults,
ScannerContext scannerContext)
Grab the next row's worth of values.
|
protected boolean |
nextRow(ScannerContext scannerContext,
Cell curRowCell) |
private boolean |
populateFromJoinedHeap(List<Cell> results,
ScannerContext scannerContext) |
private boolean |
populateResult(List<Cell> results,
KeyValueHeap heap,
ScannerContext scannerContext,
Cell currentRowCell)
Fetches records with currentRow into results list, until next row, batchLimit (if not -1) is
reached, or remainingResultSize (if not -1) is reaced
|
boolean |
reseek(byte[] row)
Do a reseek to the required row.
|
protected void |
resetFilters()
Reset both the filter and the old filter.
|
void |
run()
Called at the end of an Rpc Call
RpcCallContext |
void |
shipped()
Called after a batch of rows scanned and set to be returned to client.
|
protected boolean |
shouldStop(Cell currentRowCell) |
KeyValueHeap storeHeap
KeyValueHeap joinedHeap
protected Cell joinedContinuationRow
private boolean filterClosed
protected final byte[] stopRow
protected final boolean includeStopRow
protected final CellComparator comparator
private final long readPt
private final long maxResultSize
private final ScannerContext defaultScannerContext
private final FilterWrapper filter
RegionScannerImpl(Scan scan, List<KeyValueScanner> additionalScanners, HRegion region) throws IOException
IOException
RegionScannerImpl(Scan scan, List<KeyValueScanner> additionalScanners, HRegion region, long nonceGroup, long nonce) throws IOException
IOException
public RegionInfo getRegionInfo()
getRegionInfo
in interface RegionScanner
protected void initializeScanners(Scan scan, List<KeyValueScanner> additionalScanners) throws IOException
IOException
protected void initializeKVHeap(List<KeyValueScanner> scanners, List<KeyValueScanner> joinedScanners, HRegion region) throws IOException
IOException
private IOException handleException(List<KeyValueScanner> instantiatedScanners, Throwable t)
public long getMaxResultSize()
getMaxResultSize
in interface RegionScanner
Scan.setMaxResultSize(long)
public long getMvccReadPoint()
getMvccReadPoint
in interface RegionScanner
MultiVersionConcurrencyControl
public int getBatch()
getBatch
in interface RegionScanner
Scan.setBatch(int)
protected void resetFilters() throws IOException
IOException
- in case a filter raises an I/O exception.public boolean next(List<Cell> outResults) throws IOException
InternalScanner
next
in interface InternalScanner
outResults
- return output arrayIOException
- epublic boolean next(List<Cell> outResults, ScannerContext scannerContext) throws IOException
InternalScanner
next
in interface InternalScanner
outResults
- return output arrayIOException
- epublic boolean nextRaw(List<Cell> outResults) throws IOException
RegionScanner
RegionScanner.nextRaw(List, ScannerContext)
nextRaw
in interface RegionScanner
outResults
- return output arrayIOException
- epublic boolean nextRaw(List<Cell> outResults, ScannerContext scannerContext) throws IOException
RegionScanner
ScannerContext
is used to enforce and track
any limits associated with this call. Any progress that exists in the ScannerContext
prior to calling this method will be LOST if ScannerContext.getKeepProgress()
is false.
Upon returning from this method, the ScannerContext
will contain information about the
progress made towards the limits. This is a special internal method to be called from
coprocessor hooks to avoid expensive setup. Caller must set the thread's readpoint, start and
close a region operation, an synchronize on the scanner object. Example:
HRegion region = ...;
RegionScanner scanner = ...
MultiVersionConcurrencyControl.setThreadReadPoint(scanner.getMvccReadPoint());
region.startRegionOperation();
try {
synchronized(scanner) {
...
boolean moreRows = scanner.nextRaw(values);
...
}
} finally {
region.closeRegionOperation();
}
nextRaw
in interface RegionScanner
outResults
- return output arrayscannerContext
- The ScannerContext
instance encapsulating all limits that should
be tracked during calls to this method. The progress towards these limits can be
tracked within this instance.IOException
- eprivate boolean populateFromJoinedHeap(List<Cell> results, ScannerContext scannerContext) throws IOException
IOException
private boolean populateResult(List<Cell> results, KeyValueHeap heap, ScannerContext scannerContext, Cell currentRowCell) throws IOException
heap
- KeyValueHeap to fetch data from.It must be positioned on correct row before call.scannerContext
- currentRowCell
- KeyValueHeap.next()
IOException
private boolean moreCellsInRow(Cell nextKv, Cell currentRowCell)
nextKv
- currentRowCell
- public boolean isFilterDone() throws IOException
isFilterDone
in interface RegionScanner
IOException
- in case of I/O failure on a filter.private boolean isFilterDoneInternal() throws IOException
IOException
private boolean nextInternal(List<Cell> results, ScannerContext scannerContext) throws IOException
IOException
protected void incrementCountOfRowsFilteredMetric(ScannerContext scannerContext)
protected void incrementCountOfRowsScannedMetric(ScannerContext scannerContext)
private boolean joinedHeapMayHaveData(Cell currentRowCell) throws IOException
currentRowCell
- IOException
private boolean filterRow() throws IOException
List<KeyValue> kvs
) functions. While 0.94 code or older,
it may not implement hasFilterRow as HBase-6429 expects because 0.94 hasFilterRow() only
returns true when filterRow(List<KeyValue> kvs
) is overridden not the filterRow().
Therefore, the filterRow() will be skipped.IOException
private boolean filterRowKey(Cell current) throws IOException
IOException
protected boolean nextRow(ScannerContext scannerContext, Cell curRowCell) throws IOException
IOException
protected boolean shouldStop(Cell currentRowCell)
public void close()
InternalScanner
close
in interface Closeable
close
in interface AutoCloseable
close
in interface InternalScanner
KeyValueHeap getStoreHeapForTesting()
public boolean reseek(byte[] row) throws IOException
RegionScanner
reseek
in interface RegionScanner
IOException
public void shipped() throws IOException
Shipper
shipped
in interface Shipper
IOException
public void run() throws IOException
RpcCallback
RpcCallContext
run
in interface RpcCallback
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.