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


##########
raft/src/main/java/org/apache/kafka/raft/internals/AddVoterHandler.java:
##########
@@ -156,6 +156,23 @@ public CompletableFuture<AddRaftVoterResponseData> 
handleAddVoterRequest(
             );
         }
 
+
+        if (!ackWhenCommitted && partitionState.hasSeenReplicaKey(voterKey)) {
+            // ackWhenCommitted is used to distinguish the request from admin
+            // or broker. If it comes from broker and had been in cluster, we 
should
+            // reject it.
+            return CompletableFuture.completedFuture(
+                RaftUtil.addVoterResponse(
+                    Errors.INVALID_VOTER_KEY,
+                    String.format(
+                        "The voter key for %s has joined the set of voters.",

Review Comment:
   ```suggestion
                           "The voter key for %s has already joined the set of 
voters.",
   ```



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