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


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -3356,30 +3366,51 @@ private boolean 
shouldSendAddOrRemoveVoterRequest(FollowerState state, long curr
             quorumConfig.autoJoin() && 
state.hasUpdateVoterSetPeriodExpired(currentTimeMs);
     }
 
+    private boolean shouldSendAddVoterRequest(FollowerState state, long 
currentTimeMs) {
+        return canJoin && autoJoinEnable(state, currentTimeMs);
+    }
+
+    private boolean shouldSendRemoveVoterRequest(FollowerState state, long 
currentTimeMs) {
+        final var localReplicaKey = quorum.localReplicaKeyOrThrow();
+        final var voters = partitionState.lastVoterSet();
+
+        if (voters.voterIds().contains(localReplicaKey.id())) {
+            if (autoJoinEnable(state, currentTimeMs)) {
+                canJoin = true;

Review Comment:
   We might need some comments here to explain why we need to set `canJoin` to 
true. I think it's for the case:
   1. The controller is a bootstrap controller
   2. The node has to be removed due to directory id difference.
   3. After the node removed, it'll get added soon with the correct directory 
id.
   
   Am I right?



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