TaiJuWu commented on code in PR #20859:
URL: https://github.com/apache/kafka/pull/20859#discussion_r2513085045


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -222,6 +222,11 @@ public final class KafkaRaftClient<T> implements 
RaftClient<T> {
     private volatile RemoveVoterHandler removeVoterHandler;
     private volatile UpdateVoterHandler updateVoterHandler;
 
+    // When the node is a startup node, we need a flag to join the
+    // cluster once it is removed.
+    private volatile boolean skipFirstAutoJoinAttempt = false;
+    private volatile boolean hasJoin = false;

Review Comment:
   You are right so I am confused why this algorithm work, maybe I miss 
something.



##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -3347,13 +3359,20 @@ private long pollFollowerAsVoter(FollowerState state, 
long currentTimeMs) {
         );
     }
 
+
     private boolean shouldSendAddOrRemoveVoterRequest(FollowerState state, 
long currentTimeMs) {
+        // When the node is bootstap, it should not send addVoterRequest 
immediately.
+        if (skipFirstAutoJoinAttempt) {
+            skipFirstAutoJoinAttempt = false;

Review Comment:
   You are right so I am confused why this algorithm work, maybe I miss 
something.



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