Package org.apache.hadoop.hbase.client
Class AsyncBatchRpcRetryingCaller<T>
java.lang.Object
org.apache.hadoop.hbase.client.AsyncBatchRpcRetryingCaller<T>
Retry caller for batch.
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static final class
private static final class
-
Field Summary
Modifier and TypeFieldDescriptionprivate final IdentityHashMap<Action,
List<RetriesExhaustedException.ThrowableWithExtraContext>> private final IdentityHashMap<Action,
CompletableFuture<T>> private final AsyncConnectionImpl
private final List<CompletableFuture<T>>
private static final org.slf4j.Logger
private final int
private final long
private final HBaseServerExceptionPauseManager
private final org.apache.hbase.thirdparty.io.netty.util.Timer
private final long
private final int
private final long
private final TableName
-
Constructor Summary
ConstructorDescriptionAsyncBatchRpcRetryingCaller
(org.apache.hbase.thirdparty.io.netty.util.Timer retryTimer, AsyncConnectionImpl conn, TableName tableName, List<? extends Row> actions, long pauseNs, long pauseNsForServerOverloaded, int maxAttempts, long operationTimeoutNs, long rpcTimeoutNs, int startLogErrorsCnt, Map<String, byte[]> requestAttributes) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addError
(Iterable<Action> actions, Throwable error, ServerName serverName) private void
addError
(Action action, 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> indexMap) call()
private void
private void
failAll
(Stream<Action> actions, int tries, Throwable error, ServerName serverName) private void
private String
getExtraContextForError
(ServerName serverName) private void
groupAndSend
(Stream<Action> actions, int tries) private static boolean
hasIncrementOrAppend
(Row action) private static boolean
hasIncrementOrAppend
(RowMutations mutations) private void
logException
(int tries, Supplier<Stream<AsyncBatchRpcRetryingCaller.RegionRequest>> regionsSupplier, Throwable error, ServerName serverName) private void
onComplete
(Map<byte[], AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion, int tries, ServerName serverName, MultiResponse resp) 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
onError
(Map<byte[], AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion, int tries, Throwable t, ServerName serverName) 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, Throwable error)
-
Field Details
-
LOG
-
retryTimer
-
conn
-
tableName
-
actions
-
futures
-
action2Future
-
action2Errors
-
maxAttempts
-
operationTimeoutNs
-
rpcTimeoutNs
-
startLogErrorsCnt
-
startNs
-
pauseManager
-
requestAttributes
-
-
Constructor Details
-
AsyncBatchRpcRetryingCaller
public AsyncBatchRpcRetryingCaller(org.apache.hbase.thirdparty.io.netty.util.Timer retryTimer, AsyncConnectionImpl conn, TableName tableName, List<? extends Row> actions, long pauseNs, long pauseNsForServerOverloaded, int maxAttempts, long operationTimeoutNs, long rpcTimeoutNs, int startLogErrorsCnt, Map<String, byte[]> requestAttributes)
-
-
Method Details
-
hasIncrementOrAppend
-
hasIncrementOrAppend
-
removeErrors
-
logException
private void logException(int tries, Supplier<Stream<AsyncBatchRpcRetryingCaller.RegionRequest>> regionsSupplier, Throwable error, ServerName serverName) -
getExtraContextForError
-
addError
-
addError
-
failOne
-
failAll
-
failAll
-
buildReq
private org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MultiRequest buildReq(Map<byte[], AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion, List<CellScannable> cells, Map<Integer, throws IOExceptionInteger> indexMap) - Throws:
IOException
-
onComplete
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) -
onComplete
private void onComplete(Map<byte[], AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion, int tries, ServerName serverName, MultiResponse resp) -
sendToServer
private void sendToServer(ServerName serverName, AsyncBatchRpcRetryingCaller.ServerRequest serverReq, int tries) -
sendOrDelay
private void sendOrDelay(Map<ServerName, AsyncBatchRpcRetryingCaller.ServerRequest> actionsByServer, int tries) -
onError
private void onError(Map<byte[], AsyncBatchRpcRetryingCaller.RegionRequest> actionsByRegion, int tries, Throwable t, ServerName serverName) -
tryResubmit
-
groupAndSend
-
call
-