rpuch commented on code in PR #7539:
URL: https://github.com/apache/ignite-3/pull/7539#discussion_r2773425105


##########
modules/replicator/src/main/java/org/apache/ignite/internal/raft/client/TopologyAwareRaftGroupService.java:
##########
@@ -145,25 +152,30 @@ private TopologyAwareRaftGroupService(
             public void onNodeJoined(LogicalNode appearedNode, 
LogicalTopologySnapshot newTopology) {
                 Peer peer = new Peer(appearedNode.name(), 0);
 
-                if (peers().contains(peer)) {
-                    if (serverEventHandler.isSubscribed() && 
appearedNode.name().equals(peer.consistentId())) {
-                        LOG.info("New peer will be sending a leader elected 
notification [grpId={}, consistentId={}]", groupId(),
-                                peer.consistentId());
-
-                        subscribeToNode(appearedNode, 
peer).thenComposeAsync(subscribed -> {
-                            if (subscribed) {
-                                return refreshAndGetLeaderWithTerm()
-                                        .thenAcceptAsync(leaderWithTerm -> {
-                                            if (!leaderWithTerm.isEmpty()
-                                                    && 
appearedNode.name().equals(leaderWithTerm.leader().consistentId())) {
-                                                
serverEventHandler.onLeaderElected(appearedNode, leaderWithTerm.term());
-                                            }
-                                        }, executor);
-                            }
-
-                            return nullCompletedFuture();
-                        }, executor);
-                    }
+                if (peers().contains(peer) && 
serverEventHandler.isSubscribed()) {
+                    LOG.info("New peer will be sending a leader elected 
notification [grpId={}, consistentId={}]", groupId(),
+                            peer.consistentId());
+
+                    AtomicBoolean leftWhileSubscribing = new 
AtomicBoolean(false);
+                    nodeLeftLtDuringSubscriptionMarkers.put(appearedNode.id(), 
leftWhileSubscribing);
+
+                    subscribeToNode(appearedNode, peer, leftWhileSubscribing)
+                            .thenComposeAsync(subscribed -> {
+                                if (subscribed) {

Review Comment:
   We only put to `leftWhileSubscribing` when subscribing, so we don't need to 
do anything related to it on unsubscribing



-- 
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]

Reply via email to