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
IOException
public HRegionInfo getRegionInfo()
getRegionInfo
in interface RegionScanner
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, 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()
IOException
private boolean moreCellsInRow(Cell nextKv, byte[] currentRow, int offset, short length)
nextKv
- currentRow
- offset
- length
- 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(byte[] currentRow, int offset, short length) throws IOException
currentRow
- offset
- length
- IOException
private boolean filterRow() throws IOException
IOException
private boolean filterRowKey(byte[] row, int offset, short length) throws IOException
IOException
protected boolean nextRow(ScannerContext scannerContext, byte[] currentRow, int offset, short length) throws IOException
IOException
protected boolean isStopRow(byte[] currentRow, int offset, short length)
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
private IOException handleFileNotFound(FileNotFoundException fnfe) throws IOException
IOException
private void abortRegionServer(String msg) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.