denis-chudov commented on code in PR #6389:
URL: https://github.com/apache/ignite-3/pull/6389#discussion_r2276345959
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -1124,6 +1143,25 @@ private void
sendSafeTimeSyncIfReplicaReady(CompletableFuture<Replica> replicaFu
});
}
+ private void tryToLogTimeoutFailure(ReplicationGroupId replicaGroupId,
Throwable timeoutException) {
+ Integer currentAttempt =
timeoutAttemptsCounters.computeIfPresent(replicaGroupId, (id, attempts) ->
attempts + 1);
+
+ assert currentAttempt != null;
Review Comment:
I would replace this code to regular `compute`, we don't need assertion
errors (and failure handler triggers) on possible races between this method and
replica stop.
To protect from map leaks you can catch AwaitReplicaTimeoutException in
`sendSafeTimeSyncIfReplicaReady` and remove the map entry on this exception.
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -1103,12 +1113,21 @@ private void
sendSafeTimeSyncIfReplicaReady(CompletableFuture<Replica> replicaFu
Replica replica = replicaFuture.join();
+ ReplicationGroupId replicaGroupId = replica.groupId();
+
ReplicaSafeTimeSyncRequest req =
REPLICA_MESSAGES_FACTORY.replicaSafeTimeSyncRequest()
- .groupId(toReplicationGroupIdMessage(replica.groupId()))
+ .groupId(toReplicationGroupIdMessage(replicaGroupId))
.build();
replica.processRequest(req, localNodeId).whenComplete((res, ex) -> {
if (ex != null) {
+ if (hasCause(ex, TimeoutException.class,
ReplicationTimeoutException.class)) {
Review Comment:
please add `AwaitReplicaTimeoutException` as well (also you can remove map
entry when catching this exception)
--
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]