jsancio commented on code in PR #16735: URL: https://github.com/apache/kafka/pull/16735#discussion_r1704027667
########## raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java: ########## @@ -2153,6 +2175,84 @@ private CompletableFuture<RemoveRaftVoterResponseData> handleRemoveVoterRequest( ); } + private CompletableFuture<UpdateRaftVoterResponseData> handleUpdateVoterRequest( + RaftRequest.Inbound requestMetadata, + long currentTimeMs + ) { + UpdateRaftVoterRequestData data = (UpdateRaftVoterRequestData) requestMetadata.data(); + + if (!hasValidClusterId(data.clusterId())) { + return completedFuture( + RaftUtil.updateVoterResponse( + Errors.INCONSISTENT_CLUSTER_ID, + requestMetadata.listenerName(), + quorum.leaderAndEpoch(), + quorum.leaderEndpoints() + ) + ); + } + + Optional<Errors> leaderValidation = validateLeaderOnlyRequest(data.currentLeaderEpoch()); Review Comment: Are you referring to the variable name? Replace "leaderValidation" with "leaderValidationError"? ########## raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java: ########## @@ -543,6 +555,15 @@ public void initialize( quorumConfig.requestTimeoutMs(), logContext ); + + // Specialized remove voter handler Review Comment: Done ########## raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java: ########## @@ -2153,6 +2175,84 @@ private CompletableFuture<RemoveRaftVoterResponseData> handleRemoveVoterRequest( ); } + private CompletableFuture<UpdateRaftVoterResponseData> handleUpdateVoterRequest( + RaftRequest.Inbound requestMetadata, + long currentTimeMs + ) { + UpdateRaftVoterRequestData data = (UpdateRaftVoterRequestData) requestMetadata.data(); + + if (!hasValidClusterId(data.clusterId())) { + return completedFuture( + RaftUtil.updateVoterResponse( + Errors.INCONSISTENT_CLUSTER_ID, + requestMetadata.listenerName(), + quorum.leaderAndEpoch(), + quorum.leaderEndpoints() + ) + ); + } + + Optional<Errors> leaderValidation = validateLeaderOnlyRequest(data.currentLeaderEpoch()); Review Comment: Done -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org