@InterfaceAudience.Private public abstract class ClientScanner extends AbstractClientScanner
Modifier and Type | Field and Description |
---|---|
protected Queue<Result> |
cache |
protected int |
caching |
protected ScannerCallableWithReplicas |
callable |
protected RpcRetryingCaller<Result[]> |
caller |
protected boolean |
closed |
protected org.apache.hadoop.conf.Configuration |
conf |
private ClusterConnection |
connection |
protected HRegionInfo |
currentRegion |
protected long |
lastNext |
protected Result |
lastResult |
private static org.slf4j.Logger |
LOG |
protected long |
maxScannerResultSize |
protected ExecutorService |
pool |
protected int |
primaryOperationTimeout |
private int |
retries |
protected RpcControllerFactory |
rpcControllerFactory |
protected Scan |
scan |
protected boolean |
scanMetricsPublished |
protected int |
scannerTimeout |
private ScanResultCache |
scanResultCache |
protected TableName |
tableName |
scanMetrics
Constructor and Description |
---|
ClientScanner(org.apache.hadoop.conf.Configuration conf,
Scan scan,
TableName tableName,
ClusterConnection connection,
RpcRetryingCallerFactory rpcFactory,
RpcControllerFactory controllerFactory,
ExecutorService pool,
int primaryOperationTimeout)
Create a new ClientScanner for the specified table Note that the passed
Scan 's start
row maybe changed changed. |
Modifier and Type | Method and Description |
---|---|
protected void |
addEstimatedSize(long estimatedHeapSizeOfResult) |
private Result[] |
call(ScannerCallableWithReplicas callable,
RpcRetryingCaller<Result[]> caller,
int scannerTimeout,
boolean updateCurrentRegion) |
void |
close()
Closes the scanner and releases any resources it has allocated
|
private void |
closeScanner() |
private void |
closeScannerIfExhausted(boolean exhausted) |
protected abstract ScannerCallable |
createScannerCallable()
Will be called in moveToNextRegion to create ScannerCallable.
|
int |
getCacheCount() |
int |
getCacheSize() |
protected int |
getCaching() |
protected org.apache.hadoop.conf.Configuration |
getConf() |
protected ClusterConnection |
getConnection() |
protected long |
getMaxResultSize() |
protected ExecutorService |
getPool() |
protected int |
getPrimaryOperationTimeout() |
protected int |
getRetries() |
protected Scan |
getScan() |
protected int |
getScannerTimeout() |
protected TableName |
getTable() |
protected long |
getTimestamp() |
private void |
handleScanError(DoNotRetryIOException e,
org.apache.commons.lang3.mutable.MutableBoolean retryAfterOutOfOrderException,
int retriesLeft) |
protected void |
initCache() |
protected void |
initSyncCache() |
(package private) boolean |
isAnyRPCcancelled() |
protected void |
loadCache()
Contact the servers to load more
Result s in the cache. |
protected boolean |
moveToNextRegion()
Close the previous scanner and create a new ScannerCallable for the next scanner.
|
Result |
next()
Grab the next row's worth of values.
|
protected Result |
nextWithSyncCache() |
private boolean |
regionExhausted(Result[] values) |
boolean |
renewLease()
Allow the client to renew the scanner's lease on the server.
|
private boolean |
scanExhausted(Result[] values) |
protected abstract boolean |
setNewStartKey()
Will be called in moveToNextRegion when currentRegion is null.
|
protected void |
writeScanMetrics()
Publish the scan metrics.
|
getScanMetrics, initScanMetrics
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
iterator, next
forEach, spliterator
private static final org.slf4j.Logger LOG
protected boolean closed
protected HRegionInfo currentRegion
protected ScannerCallableWithReplicas callable
private final ScanResultCache scanResultCache
protected final int caching
protected long lastNext
protected Result lastResult
protected final long maxScannerResultSize
private final ClusterConnection connection
protected final int scannerTimeout
protected boolean scanMetricsPublished
protected RpcRetryingCaller<Result[]> caller
protected RpcControllerFactory rpcControllerFactory
protected org.apache.hadoop.conf.Configuration conf
protected final int primaryOperationTimeout
private int retries
protected final ExecutorService pool
public ClientScanner(org.apache.hadoop.conf.Configuration conf, Scan scan, TableName tableName, ClusterConnection connection, RpcRetryingCallerFactory rpcFactory, RpcControllerFactory controllerFactory, ExecutorService pool, int primaryOperationTimeout) throws IOException
Scan
's start
row maybe changed changed.conf
- The Configuration
to use.scan
- Scan
to use in this scannertableName
- The table that we wish to scanconnection
- Connection identifying the clusterIOException
protected ClusterConnection getConnection()
protected int getRetries()
protected int getScannerTimeout()
protected org.apache.hadoop.conf.Configuration getConf()
protected ExecutorService getPool()
protected int getPrimaryOperationTimeout()
protected int getCaching()
protected long getTimestamp()
protected long getMaxResultSize()
private void closeScanner() throws IOException
IOException
protected abstract boolean setNewStartKey()
false
if we have reached the stop row. Otherwise true
.protected abstract ScannerCallable createScannerCallable()
protected boolean moveToNextRegion()
Marked as protected only because TestClientScanner need to override this method.
boolean isAnyRPCcancelled()
private Result[] call(ScannerCallableWithReplicas callable, RpcRetryingCaller<Result[]> caller, int scannerTimeout, boolean updateCurrentRegion) throws IOException
IOException
protected void writeScanMetrics()
Scan.setScanMetricsEnabled(boolean)
protected void initSyncCache()
protected Result nextWithSyncCache() throws IOException
IOException
public int getCacheSize()
private boolean scanExhausted(Result[] values)
private boolean regionExhausted(Result[] values)
private void closeScannerIfExhausted(boolean exhausted) throws IOException
IOException
private void handleScanError(DoNotRetryIOException e, org.apache.commons.lang3.mutable.MutableBoolean retryAfterOutOfOrderException, int retriesLeft) throws DoNotRetryIOException
DoNotRetryIOException
protected void loadCache() throws IOException
Result
s in the cache.IOException
protected void addEstimatedSize(long estimatedHeapSizeOfResult)
public int getCacheCount()
public void close()
ResultScanner
public boolean renewLease()
ResultScanner
protected void initCache()
public Result next() throws IOException
ResultScanner
IOException
- eCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.