ahuang98 commented on code in PR #18240:
URL: https://github.com/apache/kafka/pull/18240#discussion_r1901142655
##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -550,9 +550,10 @@ public void initialize(
onBecomeFollower(currentTimeMs);
}
- // When there is only a single voter, become candidate immediately
- if (quorum.isOnlyVoter() && !quorum.isCandidate()) {
- transitionToCandidate(currentTimeMs);
+ // When there is only a single voter, become prospective immediately.
+ // transitionToProspective will handle short-circuiting voter to
candidate state
+ if (quorum.isOnlyVoter() && !quorum.isNomineeState() &&
!quorum.isLeader()) {
Review Comment:
Discussed offline, technically the replica can transition to leader due to
the above conditional.
We can improve this conditional by directly checking if the replica is
Unattached or Follower, and merge this conditional into the above conditional
--
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]