vldpyatkov commented on code in PR #2858:
URL: https://github.com/apache/ignite-3/pull/2858#discussion_r1401898054
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -346,7 +347,9 @@ private void onReplicaMessageReceived(NetworkMessage
message, String senderConsi
}
private static boolean indicatesUnexpectedProblem(Throwable ex) {
- return !(ex instanceof ExpectedReplicationException);
+ ex = unwrapCause(ex);
+
+ return !(ex instanceof ExpectedReplicationException) && !(ex
instanceof PrimaryReplicaMissException);
Review Comment:
I believe we shouldn't ignore exceptions because this hides internal
behavior. PrimaryReplicaMissException must not happen often; if it does, we
also have to be seeing this. The retry doubles the time of the operation's
execution.
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java:
##########
@@ -462,29 +466,25 @@ private <R> CompletableFuture<R> enlistWithRetry(
boolean full,
@Nullable BiPredicate<R, ReplicaRequest> noWriteChecker
) {
- CompletableFuture<R> result = new CompletableFuture<>();
+ return enlist(partId, tx)
+ .thenCompose(primaryReplicaAndTerm -> trackingInvoke(tx,
partId, mapFunc, full, primaryReplicaAndTerm, noWriteChecker))
+ .handle((response, e) -> {
+ if (e == null) {
+ return completedFuture(response);
+ }
- enlist(partId, tx).thenCompose(
- primaryReplicaAndTerm -> trackingInvoke(tx, partId,
mapFunc, full, primaryReplicaAndTerm, noWriteChecker))
- .handle((res0, e) -> {
- if (e != null) {
- if (e.getCause() instanceof
PrimaryReplicaMissException && attempts > 0) {
- return enlistWithRetry(tx, partId, mapFunc,
attempts - 1, full, noWriteChecker).handle((r2, e2) -> {
- if (e2 != null) {
- return result.completeExceptionally(e2);
- } else {
- return result.complete(r2);
- }
- });
+ if (attempts > 0 && e.getCause() instanceof
PrimaryReplicaMissException) {
+ if (LOG.isInfoEnabled()) {
Review Comment:
I would remove this check because the calculation is trivial.
--
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]