@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.slf4j.Logger |
LOG |
private Set<ScannerCallable> |
outstandingCallables |
protected ExecutorService |
pool |
private int |
regionReplication |
(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) |
private void |
addCallsForOtherReplicas(ResultBoundedCompletionService<Pair<Result[],ScannerCallable>> cs,
int min,
int max) |
Result[] |
call(int timeout)
Computes a result, or throws an exception if unable to do so.
|
int |
getCaching() |
Cursor |
getCursor() |
String |
getExceptionMessageAdditionalDetail() |
HRegionInfo |
getHRegionInfo() |
(package private) boolean |
isAnyRPCcancelled() |
boolean |
isHeartbeatMessage() |
ScannerCallable.MoreResults |
moreResultsForScan() |
ScannerCallable.MoreResults |
moreResultsInRegion() |
void |
prepare(boolean reload)
Prepare by setting up any connections to servers, etc., ahead of call invocation.
|
void |
setCaching(int caching) |
void |
setClose() |
void |
setRenew(boolean val) |
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 call 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.slf4j.Logger LOG
volatile ScannerCallable currentScannerCallable
AtomicBoolean replicaSwitched
final ClusterConnection cConnection
protected final ExecutorService pool
protected final int timeBeforeReplicas
private final int retries
private Result lastResult
private final RpcRetryingCaller<Result[]> caller
private org.apache.hadoop.conf.Configuration conf
private int scannerTimeout
private Set<ScannerCallable> outstandingCallables
private boolean someRPCcancelled
private int regionReplication
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 ScannerCallable.MoreResults moreResultsInRegion()
public ScannerCallable.MoreResults moreResultsForScan()
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)
private void addCallsForOtherReplicas(ResultBoundedCompletionService<Pair<Result[],ScannerCallable>> cs, 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
prepare
in interface RetryingCallable<Result[]>
reload
- Set this to true if need to requery locationsIOException
- epublic void throwable(Throwable t, boolean retrying)
RetryingCallable
throwable
in interface RetryingCallable<Result[]>
t
- throwable which was thrownretrying
- 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[]>
pause
- time to pausetries
- amount of tries until till sleepCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.