@InterfaceAudience.Private class 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 static org.slf4j.Logger |
LOG |
private long |
maxResultSize |
private static List<Cell> |
MOCKED_LIST
A mocked list implementation - discards all updates.
|
private String |
operationId |
private long |
readPt |
protected HRegion |
region |
private RegionServerServices |
rsServices |
private ConcurrentHashMap<RegionScanner,Long> |
scannerReadPoints |
protected byte[] |
stopRow |
(package private) KeyValueHeap |
storeHeap |
Constructor and Description |
---|
RegionScannerImpl(Scan scan,
List<KeyValueScanner> additionalScanners,
HRegion region,
long nonceGroup,
long nonce) |
Modifier and Type | Method and Description |
---|---|
private void |
checkClientDisconnect(Optional<RpcCall> rpcCall) |
void |
close()
Closes the scanner and releases any resources it has allocated n
|
private void |
closeInternal() |
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()
Returns The Scanner's MVCC readPt see
MultiVersionConcurrencyControl |
String |
getOperationId() |
RegionInfo |
getRegionInfo()
Returns The RegionInfo for this scanner.
|
private IOException |
handleException(List<KeyValueScanner> instantiatedScanners,
Throwable t) |
private static boolean |
hasNonce(HRegion region,
long nonce) |
private void |
incrementCountOfRowsFilteredMetric(ScannerContext scannerContext) |
private void |
incrementCountOfRowsScannedMetric(ScannerContext scannerContext) |
protected void |
initializeKVHeap(List<KeyValueScanner> scanners,
List<KeyValueScanner> joinedScanners,
HRegion region) |
private void |
initializeScanners(Scan scan,
List<KeyValueScanner> additionalScanners) |
boolean |
isFilterDone()
Returns True if a filter rules the scanner is over, done.
|
private boolean |
isFilterDoneInternal() |
private boolean |
joinedHeapMayHaveData(Cell currentRowCell)
Returns true when the joined heap may have data for the current row
|
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)
Returns true if more cells exist after this batch, false if scanner is done
|
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.
|
private void |
resetProgress(ScannerContext scannerContext,
int initialBatchProgress,
long initialSizeProgress,
long initialHeapSizeProgress) |
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) |
private static final org.slf4j.Logger LOG
KeyValueHeap storeHeap
KeyValueHeap joinedHeap
protected Cell joinedContinuationRow
private boolean filterClosed
protected final byte[] stopRow
protected final boolean includeStopRow
protected final CellComparator comparator
private final ConcurrentHashMap<RegionScanner,Long> scannerReadPoints
private final long readPt
private final long maxResultSize
private final ScannerContext defaultScannerContext
private final FilterWrapper filter
private final String operationId
private RegionServerServices rsServices
private static final List<Cell> MOCKED_LIST
RegionScannerImpl(Scan scan, List<KeyValueScanner> additionalScanners, HRegion region, long nonceGroup, long nonce) throws IOException
IOException
public RegionInfo getRegionInfo()
RegionScanner
getRegionInfo
in interface RegionScanner
private 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()
RegionScanner
MultiVersionConcurrencyControl
getMvccReadPoint
in interface RegionScanner
public int getBatch()
getBatch
in interface RegionScanner
Scan.setBatch(int)
public String getOperationId()
getOperationId
in interface RegionScanner
OperationWithAttributes.ID_ATRIBUTE
value, or null if
not set.protected final 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 array n * @return true if more rows exist after this one, false if
scanner is doneIOException
- 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.KeyValueHeap.next()
IOException
private boolean moreCellsInRow(Cell nextKv, Cell 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 void checkClientDisconnect(Optional<RpcCall> rpcCall) throws CallerDisconnectedException
CallerDisconnectedException
private void resetProgress(ScannerContext scannerContext, int initialBatchProgress, long initialSizeProgress, long initialHeapSizeProgress)
private boolean nextInternal(List<Cell> results, ScannerContext scannerContext) throws IOException
IOException
private void incrementCountOfRowsFilteredMetric(ScannerContext scannerContext)
private void incrementCountOfRowsScannedMetric(ScannerContext scannerContext)
private boolean joinedHeapMayHaveData(Cell currentRowCell) throws IOException
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)
private void closeInternal()
public void close()
InternalScanner
close
in interface Closeable
close
in interface AutoCloseable
close
in interface InternalScanner
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–2020 The Apache Software Foundation. All rights reserved.