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


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -3356,30 +3366,56 @@ private boolean 
shouldSendAddOrRemoveVoterRequest(FollowerState state, long curr
             quorumConfig.autoJoin() && 
state.hasUpdateVoterSetPeriodExpired(currentTimeMs);
     }
 
+    private boolean shouldSendAddVoterRequest(FollowerState state, long 
currentTimeMs) {
+        return canAutoJoin && maybeAutoJoin(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 (maybeAutoJoin(state, currentTimeMs)) {
+                // When the bootstrap controller needs to update directory id,
+                // it should be removed and then rejoining to cluster
+                // In such a case, we should set canAutoJoin to true, and it 
will
+                // be removed from the cluster, update directory id and rejoin
+                // to the cluster.

Review Comment:
   if I got it correctly, it can happen when, for example, for any reasons the 
controller has a new directory ID (i.e. disk failure, ...) but it's registered 
within the voters with the old directory ID. For this reason, it needs to 
remove itself with the old directory ID and re-join with the new directory ID. 
Can we improve the comment by specify the "disk failure" as an example of a new 
directory id and why an update is needed (because of voters still include the 
old directory ID)?



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