ahuang98 commented on code in PR #19416:
URL: https://github.com/apache/kafka/pull/19416#discussion_r2050789659


##########
raft/src/main/java/org/apache/kafka/raft/internals/UpdateVoterHandler.java:
##########
@@ -104,26 +111,39 @@ public CompletableFuture<UpdateRaftVoterResponseData> 
handleUpdateVoterRequest(
             );
         }
 
-        // KAFKA-16538 will implement the case when the kraft.version is 0
-        // Check that the cluster supports kraft.version >= 1
+        // Read the voter set from the log or leader state
         KRaftVersion kraftVersion = partitionState.lastKraftVersion();
-        if (!kraftVersion.isReconfigSupported()) {
-            return CompletableFuture.completedFuture(
-                RaftUtil.updateVoterResponse(
-                    Errors.UNSUPPORTED_VERSION,
-                    requestListenerName,
-                    new LeaderAndEpoch(
-                        localId,
-                        leaderState.epoch()
-                    ),
-                    leaderState.leaderEndpoints()
-                )
-            );
-        }
+        final Optional<KRaftVersionUpgrade.Voters> inMemoryVoters;
+        final Optional<VoterSet> voters;
+        if (kraftVersion.isReconfigSupported()) {
+            inMemoryVoters = Optional.empty();
 
-        // Check that there are no uncommitted VotersRecord
-        Optional<LogHistory.Entry<VoterSet>> votersEntry = 
partitionState.lastVoterSetEntry();
-        if (votersEntry.isEmpty() || votersEntry.get().offset() >= 
highWatermark.get()) {
+            // Check that there are no uncommitted VotersRecord
+            Optional<LogHistory.Entry<VoterSet>> votersEntry = 
partitionState.lastVoterSetEntry();
+            if (votersEntry.isEmpty() || votersEntry.get().offset() >= 
highWatermark.get()) {

Review Comment:
   so if there is an uncommitted voters record this update is no-op (we wait 
until there are only committed voters records present before updating the 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to