JAkutenshi commented on code in PR #4446: URL: https://github.com/apache/ignite-3/pull/4446#discussion_r1872693617
########## modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java: ########## @@ -1298,6 +1323,79 @@ private CompletableFuture<Boolean> onPrimaryExpired(PrimaryReplicaEventParameter return falseCompletedFuture(); } + // TODO: move to Replica https://issues.apache.org/jira/browse/IGNITE-23750 + private void registerFailoverCallback(ReplicationGroupId replicationGroupId) { + CompletableFuture<Replica> replicaFuture = replicaManager.replica(replicationGroupId); Review Comment: No, I think that `!electedPrimaryReplica.isDone()` isn't possible. Moreover even if then there is not the case. When we should check `isDone` on replica future? - On `ReplicaManager` / Ignite node stopping with `ReplicaStoppingException` compeltion. - When we need urgent replication request's response without extra waiting. That's why I think we may wait there for (may be exceptional) completeness there. And why the state is impossible. There are 3 places to create the future: 1. when replica starts - if the future already was created -- complete with new replica; - otherwise put new replica future to the `replicas` map. 2. when `ReplicaManager` got `PlacementDriver`'s message and it may be only `LeaseGrantMessage`. 3. when we got a `ReplicaRequest` for yet not started replica and then we create a future and bind a request handle on incomplete future. Point 2 implies that we won't get any `PRIMARY_REPLICA_ELECTED` event until replica future will be completed, because then replica couldn't handle `LeaseGrantMessage`and became a primary. -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org