jsancio commented on code in PR #19416: URL: https://github.com/apache/kafka/pull/19416#discussion_r2054309528
########## raft/src/main/java/org/apache/kafka/raft/VoterSet.java: ########## @@ -250,6 +251,26 @@ public Optional<VoterSet> updateVoter(VoterNode voter) { return Optional.empty(); } + /** + * Update a voter by only comparing the node id. + * + * This update voter operation doesn't compare the directory id. This is useful when upgrading + * from a voter set that doesn't support directory id to one that supports directory ids. Review Comment: Yeah. The different is a bit subtle. In kraft.version 1 all of the voters in the voter set have a directory id. To update a voter in kraft.version 1 the node id and directory id must match. In kraft.version 0 none of the voters in the voter set have a directory id but the voter set stored KRaftVersionUpgrade may have the directory id set even though the kraft.version is 0. This is needed so that the leader can discover the directory id of all of the voters before upgrading the kraft.version. Now lets assume that we have a cluster in kraft.version 0 with the voter id 1, 2 and 3. All of the voter are upgraded to Kafka 4.1 and they send an update voter request with the directory ids d1, d2 and d3 respectively. Lets say that the leader is 1 and the leader updates the in-memory voter set to include all of the directories. Finally, voter 3 crashes and replaces its disk. The new directory id for voter 3 is d3'. For the upgrade to be correct voter 3 needs to send an update voter request and the leader (1) needs to update the voter set to be d3' even though it already has d3 in its in-memory voter set. updateVoterIgnoringDirectoryId is allowing the leader to set the voter set to the latest directory id even if it changes while in kraft version 0. -- 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