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
IOExceptionRegionScannerImpl(Scan scan, List<KeyValueScanner> additionalScanners, HRegion region, long nonceGroup, long nonce) throws IOException
IOExceptionpublic RegionInfo getRegionInfo()
getRegionInfo in interface RegionScannerprotected void initializeScanners(Scan scan, List<KeyValueScanner> additionalScanners) throws IOException
IOExceptionprotected void initializeKVHeap(List<KeyValueScanner> scanners, List<KeyValueScanner> joinedScanners, HRegion region) throws IOException
IOExceptionprivate IOException handleException(List<KeyValueScanner> instantiatedScanners, Throwable t)
public long getMaxResultSize()
getMaxResultSize in interface RegionScannerScan.setMaxResultSize(long)public long getMvccReadPoint()
getMvccReadPoint in interface RegionScannerMultiVersionConcurrencyControlpublic int getBatch()
getBatch in interface RegionScannerScan.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
InternalScannernext in interface InternalScanneroutResults - return output arrayIOException - epublic boolean next(List<Cell> outResults, ScannerContext scannerContext) throws IOException
InternalScannernext in interface InternalScanneroutResults - return output arrayIOException - epublic boolean nextRaw(List<Cell> outResults) throws IOException
RegionScannerRegionScanner.nextRaw(List, ScannerContext)nextRaw in interface RegionScanneroutResults - return output arrayIOException - epublic boolean nextRaw(List<Cell> outResults, ScannerContext scannerContext) throws IOException
RegionScannerScannerContext 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 RegionScanneroutResults - 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
IOExceptionprivate 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()IOExceptionprivate boolean moreCellsInRow(Cell nextKv, Cell currentRowCell)
nextKv - currentRowCell - public boolean isFilterDone() throws IOException
isFilterDone in interface RegionScannerIOException - in case of I/O failure on a filter.private boolean isFilterDoneInternal() throws IOException
IOExceptionprivate boolean nextInternal(List<Cell> results, ScannerContext scannerContext) throws IOException
IOExceptionprotected void incrementCountOfRowsFilteredMetric(ScannerContext scannerContext)
protected void incrementCountOfRowsScannedMetric(ScannerContext scannerContext)
private boolean joinedHeapMayHaveData(Cell currentRowCell) throws IOException
currentRowCell - IOExceptionprivate 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.IOExceptionprivate boolean filterRowKey(Cell current) throws IOException
IOExceptionprotected boolean nextRow(ScannerContext scannerContext, Cell curRowCell) throws IOException
IOExceptionprotected boolean shouldStop(Cell currentRowCell)
public void close()
InternalScannerclose in interface Closeableclose in interface AutoCloseableclose in interface InternalScannerKeyValueHeap getStoreHeapForTesting()
public boolean reseek(byte[] row) throws IOException
RegionScannerreseek in interface RegionScannerIOExceptionpublic void shipped() throws IOException
Shippershipped in interface ShipperIOExceptionpublic void run() throws IOException
RpcCallbackRpcCallContextrun in interface RpcCallbackIOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.