class HRegion.RegionScannerImpl extends Object implements RegionScanner
| Modifier and Type | Field and Description |
|---|---|
private ScannerContext |
defaultScannerContext |
private FilterWrapper |
filter |
private boolean |
filterClosed |
protected int |
isScan |
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 |
|---|
HRegion.RegionScannerImpl(Scan scan,
List<KeyValueScanner> additionalScanners,
HRegion region) |
| Modifier and Type | Method and Description |
|---|---|
private void |
abortRegionServer(String msg) |
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(byte[] row,
int offset,
short length) |
int |
getBatch() |
long |
getMaxResultSize() |
long |
getMvccReadPoint() |
HRegionInfo |
getRegionInfo() |
(package private) KeyValueHeap |
getStoreHeapForTesting() |
private IOException |
handleException(List<KeyValueScanner> instantiatedScanners,
Throwable t) |
private IOException |
handleFileNotFound(FileNotFoundException fnfe) |
protected void |
incrementCountOfRowsFilteredMetric(ScannerContext scannerContext) |
protected void |
incrementCountOfRowsScannedMetric(ScannerContext scannerContext) |
protected void |
initializeKVHeap(List<KeyValueScanner> scanners,
List<KeyValueScanner> joinedScanners,
HRegion region) |
boolean |
isFilterDone() |
private boolean |
isFilterDoneInternal() |
protected boolean |
isStopRow(byte[] currentRow,
int offset,
short length) |
private boolean |
joinedHeapMayHaveData(byte[] currentRow,
int offset,
short length) |
private boolean |
moreCellsInRow(Cell nextKv,
byte[] currentRow,
int offset,
short length)
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,
byte[] currentRow,
int offset,
short length) |
private boolean |
populateFromJoinedHeap(List<Cell> results,
ScannerContext scannerContext) |
private boolean |
populateResult(List<Cell> results,
KeyValueHeap heap,
ScannerContext scannerContext,
byte[] currentRow,
int offset,
short length)
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.
|
KeyValueHeap storeHeap
KeyValueHeap joinedHeap
protected Cell joinedContinuationRow
private boolean filterClosed
protected final int isScan
protected final byte[] stopRow
protected final HRegion region
private final long readPt
private final long maxResultSize
private final ScannerContext defaultScannerContext
private final FilterWrapper filter
HRegion.RegionScannerImpl(Scan scan, List<KeyValueScanner> additionalScanners, HRegion region) throws IOException
IOExceptionpublic HRegionInfo getRegionInfo()
getRegionInfo in interface RegionScannerprotected 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, byte[] currentRow, int offset, short length) throws IOException
heap - KeyValueHeap to fetch data from.It must be positioned on correct row before call.scannerContext - currentRow - Byte array with key we are fetching.offset - offset for currentRowlength - length for currentRowKeyValueHeap.next()IOExceptionprivate boolean moreCellsInRow(Cell nextKv, byte[] currentRow, int offset, short length)
nextKv - currentRow - offset - length - 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(byte[] currentRow,
int offset,
short length)
throws IOException
currentRow - offset - length - IOExceptionprivate boolean filterRow()
throws IOException
IOExceptionprivate boolean filterRowKey(byte[] row,
int offset,
short length)
throws IOException
IOExceptionprotected boolean nextRow(ScannerContext scannerContext, byte[] currentRow, int offset, short length) throws IOException
IOExceptionprotected boolean isStopRow(byte[] currentRow,
int offset,
short length)
public void close()
InternalScannerclose in interface Closeableclose in interface AutoCloseableclose in interface InternalScannerKeyValueHeap getStoreHeapForTesting()
public boolean reseek(byte[] row)
throws IOException
RegionScannerreseek in interface RegionScannerIOExceptionprivate IOException handleFileNotFound(FileNotFoundException fnfe) throws IOException
IOExceptionprivate void abortRegionServer(String msg) throws IOException
IOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.