@InterfaceAudience.Private class AsyncBatchRpcRetryingCaller<T> extends Object
Notice that, the operationTimeoutNs
is the total time limit now which is the same with
other single operations
And the maxAttempts
is a limit for each single operation in the batch logically. In the
implementation, we will record a tries
parameter for each operation group, and if it is
split to several groups when retrying, the sub groups will inherit the tries
. You can
imagine that the whole retrying process is a tree, and the maxAttempts
is the limit of
the depth of the tree.
Modifier and Type | Class and Description |
---|---|
private static class |
AsyncBatchRpcRetryingCaller.RegionRequest |
private static class |
AsyncBatchRpcRetryingCaller.ServerRequest |
Modifier and Type | Field and Description |
---|---|
private IdentityHashMap<Action,List<RetriesExhaustedException.ThrowableWithExtraContext>> |
action2Errors |
private IdentityHashMap<Action,CompletableFuture<T>> |
action2Future |
private List<Action> |
actions |
private AsyncConnectionImpl |
conn |
private List<CompletableFuture<T>> |
futures |
private static org.slf4j.Logger |
LOG |
private int |
maxAttempts |
private long |
operationTimeoutNs |
private long |
pauseForCQTBENs |
private long |
pauseNs |
private org.apache.hbase.thirdparty.io.netty.util.Timer |
retryTimer |
private long |
rpcTimeoutNs |
private int |
startLogErrorsCnt |
private long |
startNs |
private TableName |
tableName |
Constructor and Description |
---|
AsyncBatchRpcRetryingCaller(org.apache.hbase.thirdparty.io.netty.util.Timer retryTimer,
AsyncConnectionImpl conn,
TableName tableName,
List<? extends Row> actions,
long pauseNs,
long pauseForCQTBENs,
int maxAttempts,
long operationTimeoutNs,
long rpcTimeoutNs,
int startLogErrorsCnt) |
Modifier and Type | Method and Description |
---|---|
private void |
addError(Action action,
Throwable error,
ServerName serverName) |
private void |
addError(Iterable<Action> actions,
Throwable error,
ServerName serverName) |
private org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MultiRequest |
buildReq(Map<byte[],AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion,
List<CellScannable> cells,
Map<Integer,Integer> rowMutationsIndexMap) |
List<CompletableFuture<T>> |
call() |
private void |
failAll(Stream<Action> actions,
int tries) |
private void |
failAll(Stream<Action> actions,
int tries,
Throwable error,
ServerName serverName) |
private void |
failOne(Action action,
int tries,
Throwable error,
long currentTime,
String extras) |
private String |
getExtraContextForError(ServerName serverName) |
private void |
groupAndSend(Stream<Action> actions,
int tries) |
private void |
logException(int tries,
Supplier<Stream<AsyncBatchRpcRetryingCaller.RegionRequest>> regionsSupplier,
Throwable error,
ServerName serverName) |
private void |
onComplete(Action action,
AsyncBatchRpcRetryingCaller.RegionRequest regionReq,
int tries,
ServerName serverName,
MultiResponse.RegionResult regionResult,
List<Action> failedActions,
Throwable regionException,
org.apache.commons.lang3.mutable.MutableBoolean retryImmediately) |
private void |
onComplete(Map<byte[],AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion,
int tries,
ServerName serverName,
MultiResponse resp) |
private void |
onError(Map<byte[],AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion,
int tries,
Throwable t,
ServerName serverName) |
private long |
remainingTimeNs() |
private List<RetriesExhaustedException.ThrowableWithExtraContext> |
removeErrors(Action action) |
private void |
sendOrDelay(Map<ServerName,AsyncBatchRpcRetryingCaller.ServerRequest> actionsByServer,
int tries) |
private void |
sendToServer(ServerName serverName,
AsyncBatchRpcRetryingCaller.ServerRequest serverReq,
int tries) |
private void |
tryResubmit(Stream<Action> actions,
int tries,
boolean immediately,
boolean isCallQueueTooBig) |
private static final org.slf4j.Logger LOG
private final org.apache.hbase.thirdparty.io.netty.util.Timer retryTimer
private final AsyncConnectionImpl conn
private final List<CompletableFuture<T>> futures
private final IdentityHashMap<Action,CompletableFuture<T>> action2Future
private final IdentityHashMap<Action,List<RetriesExhaustedException.ThrowableWithExtraContext>> action2Errors
private final long pauseNs
private final long pauseForCQTBENs
private final int maxAttempts
private final long operationTimeoutNs
private final long rpcTimeoutNs
private final int startLogErrorsCnt
private final long startNs
public AsyncBatchRpcRetryingCaller(org.apache.hbase.thirdparty.io.netty.util.Timer retryTimer, AsyncConnectionImpl conn, TableName tableName, List<? extends Row> actions, long pauseNs, long pauseForCQTBENs, int maxAttempts, long operationTimeoutNs, long rpcTimeoutNs, int startLogErrorsCnt)
private long remainingTimeNs()
private List<RetriesExhaustedException.ThrowableWithExtraContext> removeErrors(Action action)
private void logException(int tries, Supplier<Stream<AsyncBatchRpcRetryingCaller.RegionRequest>> regionsSupplier, Throwable error, ServerName serverName)
private String getExtraContextForError(ServerName serverName)
private void addError(Action action, Throwable error, ServerName serverName)
private void addError(Iterable<Action> actions, Throwable error, ServerName serverName)
private void failOne(Action action, int tries, Throwable error, long currentTime, String extras)
private void failAll(Stream<Action> actions, int tries, Throwable error, ServerName serverName)
private org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MultiRequest buildReq(Map<byte[],AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion, List<CellScannable> cells, Map<Integer,Integer> rowMutationsIndexMap) throws IOException
IOException
private void onComplete(Action action, AsyncBatchRpcRetryingCaller.RegionRequest regionReq, int tries, ServerName serverName, MultiResponse.RegionResult regionResult, List<Action> failedActions, Throwable regionException, org.apache.commons.lang3.mutable.MutableBoolean retryImmediately)
private void onComplete(Map<byte[],AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion, int tries, ServerName serverName, MultiResponse resp)
private void sendToServer(ServerName serverName, AsyncBatchRpcRetryingCaller.ServerRequest serverReq, int tries)
private void sendOrDelay(Map<ServerName,AsyncBatchRpcRetryingCaller.ServerRequest> actionsByServer, int tries)
private void onError(Map<byte[],AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion, int tries, Throwable t, ServerName serverName)
private void tryResubmit(Stream<Action> actions, int tries, boolean immediately, boolean isCallQueueTooBig)
private void groupAndSend(Stream<Action> actions, int tries)
public List<CompletableFuture<T>> call()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.