ascherbakoff commented on code in PR #2720:
URL: https://github.com/apache/ignite-3/pull/2720#discussion_r1421721404
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java:
##########
@@ -465,25 +472,31 @@ private <R> CompletableFuture<R> enlistWithRetry(
Function<Long, ReplicaRequest> mapFunc,
int attempts,
boolean full,
- @Nullable BiPredicate<R, ReplicaRequest> noWriteChecker
+ @Nullable BiPredicate<R, ReplicaRequest> noWriteChecker,
+ boolean retryOnLockConflict
) {
- return enlist(partId, tx)
- .thenCompose(primaryReplicaAndTerm -> trackingInvoke(tx,
partId, mapFunc, full, primaryReplicaAndTerm, noWriteChecker))
- .handle((response, e) -> {
- if (e == null) {
- return completedFuture(response);
- }
+ return (CompletableFuture<R>) enlist(partId, tx)
+ .thenCompose(primaryReplicaAndTerm -> trackingInvoke(tx,
partId, mapFunc, full, primaryReplicaAndTerm, noWriteChecker,
+ retryOnLockConflict))
+ .handle((res0, e) -> {
+ if (e != null) {
+ // We can safely retry indefinitely on deadlock
prevention.
+ if (retryOnLockConflict && e.getCause() instanceof
LockException) {
+ return enlistWithRetry(tx, partId, mapFunc,
attempts, full, noWriteChecker, true);
Review Comment:
We can indefinitely retry on lock exception - this is safe because of
wait-die deadlock prevention properties.
> As a user I may desire fail fast approach in case of a deadlock instead of
retries until tx times out
This is not a deadlock - only the possibility of deadlock. Designed to be
handled by retry.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]