Vladislav Pyatkov created IGNITE-22207:
------------------------------------------

             Summary: Handling of AwaitPrimaryReplica request maight lead to 
the dedalock
                 Key: IGNITE-22207
                 URL: https://issues.apache.org/jira/browse/IGNITE-22207
             Project: Ignite
          Issue Type: Bug
            Reporter: Vladislav Pyatkov


h3. Motivation
We handle ReplicaUnavailableException in ReplicaService to handle request 
transparency even if the replica had not been read at the time the request was 
sent. To do this, we send AwaitReplicaRequest as a handling of the exception 
and then process the origin request when the replica is guaranteed ready.
In the event that the AwaitReplicaRequest is handled locally, we will do it 
synchronously in pendingInvokes.computeIfAbsent:
{code}
CompletableFuture<NetworkMessage> awaitReplicaFut = 
pendingInvokes.computeIfAbsent(
        targetNodeConsistentId,
        consistentId -> {
            AwaitReplicaRequest awaitReplicaReq = 
REPLICA_MESSAGES_FACTORY.awaitReplicaRequest()
                    .groupId(req.groupId())
                    .build();

            return messagingService.invoke(
                    targetNodeConsistentId,
                    awaitReplicaReq,
                    replicationConfiguration.rpcTimeout().value()
            );
        }
);
{code}
and then hands on handling of AwaitReplicaRequest, due to removing from 
pendingInvokes:
{code}
awaitReplicaFut.handle((response0, throwable0) -> {
    pendingInvokes.remove(targetNodeConsistentId, awaitReplicaFut);
...
{code}

h3. Definition of doe
Take out of the network invokation from the map compute closure.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to