@InterfaceAudience.Private class ScannerCallableWithReplicas extends Object implements RetryingCallable<Result[]>
Modifier and Type | Class and Description |
---|---|
(package private) class |
ScannerCallableWithReplicas.RetryingRPC |
Modifier and Type | Field and Description |
---|---|
private RpcRetryingCaller<Result[]> |
caller |
(package private) ClusterConnection |
cConnection |
private org.apache.hadoop.conf.Configuration |
conf |
(package private) ScannerCallable |
currentScannerCallable |
private Result |
lastResult |
private static org.apache.commons.logging.Log |
LOG |
private Set<ScannerCallable> |
outstandingCallables |
protected ExecutorService |
pool |
(package private) AtomicBoolean |
replicaSwitched |
private int |
retries |
private Scan |
scan |
private int |
scannerTimeout |
private boolean |
someRPCcancelled |
private TableName |
tableName |
protected int |
timeBeforeReplicas |
Constructor and Description |
---|
ScannerCallableWithReplicas(TableName tableName,
ClusterConnection cConnection,
ScannerCallable baseCallable,
ExecutorService pool,
int timeBeforeReplicas,
Scan scan,
int retries,
int scannerTimeout,
int caching,
org.apache.hadoop.conf.Configuration conf,
RpcRetryingCaller<Result[]> caller) |
Modifier and Type | Method and Description |
---|---|
private void |
addCallsForCurrentReplica(ResultBoundedCompletionService<Pair<Result[],ScannerCallable>> cs,
RegionLocations rl) |
private void |
addCallsForOtherReplicas(ResultBoundedCompletionService<Pair<Result[],ScannerCallable>> cs,
RegionLocations rl,
int min,
int max) |
Result[] |
call(int timeout)
Computes a result, or throws an exception if unable to do so.
|
int |
getCaching() |
String |
getExceptionMessageAdditionalDetail() |
HRegionInfo |
getHRegionInfo() |
boolean |
getServerHasMoreResults() |
boolean |
hasMoreResultsContext() |
(package private) boolean |
isAnyRPCcancelled() |
boolean |
isHeartbeatMessage() |
void |
prepare(boolean reload)
Prepare by setting up any connections to servers, etc., ahead of
RetryingCallable.call(int) invocation. |
void |
setCaching(int caching) |
void |
setClose() |
void |
setHasMoreResultsContext(boolean serverHasMoreResultsContext) |
void |
setRenew(boolean val) |
void |
setServerHasMoreResults(boolean serverHasMoreResults) |
private void |
setStartRowForReplicaCallable(ScannerCallable callable)
Set the start row for the replica callable based on the state of the last result received.
|
long |
sleep(long pause,
int tries) |
boolean |
switchedToADifferentReplica()
When a scanner switches in the middle of scanning (the 'next' call fails
for example), the upper layer
ClientScanner needs to know |
void |
throwable(Throwable t,
boolean retrying)
Called when
RetryingCallable.call(int) throws an exception and we are going to retry; take action to
make it so we succeed on next call (clear caches, do relookup of locations, etc.). |
private void |
updateCurrentlyServingReplica(ScannerCallable scanner,
Result[] result,
AtomicBoolean done,
ExecutorService pool) |
private static final org.apache.commons.logging.Log LOG
volatile ScannerCallable currentScannerCallable
AtomicBoolean replicaSwitched
final ClusterConnection cConnection
protected final ExecutorService pool
protected final int timeBeforeReplicas
private final Scan scan
private final int retries
private Result lastResult
private final RpcRetryingCaller<Result[]> caller
private final TableName tableName
private org.apache.hadoop.conf.Configuration conf
private int scannerTimeout
private Set<ScannerCallable> outstandingCallables
private boolean someRPCcancelled
public ScannerCallableWithReplicas(TableName tableName, ClusterConnection cConnection, ScannerCallable baseCallable, ExecutorService pool, int timeBeforeReplicas, Scan scan, int retries, int scannerTimeout, int caching, org.apache.hadoop.conf.Configuration conf, RpcRetryingCaller<Result[]> caller)
public void setClose()
public void setRenew(boolean val)
public void setCaching(int caching)
public int getCaching()
public HRegionInfo getHRegionInfo()
public boolean getServerHasMoreResults()
public void setServerHasMoreResults(boolean serverHasMoreResults)
public boolean hasMoreResultsContext()
public void setHasMoreResultsContext(boolean serverHasMoreResultsContext)
public Result[] call(int timeout) throws IOException
RetryingCallable
call
in interface RetryingCallable<Result[]>
timeout
- - the time available for this call. 0 for infinite.IOException
private void updateCurrentlyServingReplica(ScannerCallable scanner, Result[] result, AtomicBoolean done, ExecutorService pool)
public boolean switchedToADifferentReplica()
ClientScanner
needs to knowpublic boolean isHeartbeatMessage()
private void addCallsForCurrentReplica(ResultBoundedCompletionService<Pair<Result[],ScannerCallable>> cs, RegionLocations rl)
private void addCallsForOtherReplicas(ResultBoundedCompletionService<Pair<Result[],ScannerCallable>> cs, RegionLocations rl, int min, int max)
private void setStartRowForReplicaCallable(ScannerCallable callable)
callable
- The callable to set the start row onboolean isAnyRPCcancelled()
public void prepare(boolean reload) throws IOException
RetryingCallable
RetryingCallable.call(int)
invocation.prepare
in interface RetryingCallable<Result[]>
reload
- Set this to true if need to requery locationsIOException
- epublic void throwable(Throwable t, boolean retrying)
RetryingCallable
RetryingCallable.call(int)
throws an exception and we are going to retry; take action to
make it so we succeed on next call (clear caches, do relookup of locations, etc.).throwable
in interface RetryingCallable<Result[]>
retrying
- True if we are in retrying mode (we are not in retrying mode when max
retries == 1; we ARE in retrying mode if retries > 1 even when we are the last attempt)public String getExceptionMessageAdditionalDetail()
getExceptionMessageAdditionalDetail
in interface RetryingCallable<Result[]>
public long sleep(long pause, int tries)
sleep
in interface RetryingCallable<Result[]>
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.