lh0156 commented on code in PR #22203:
URL: https://github.com/apache/kafka/pull/22203#discussion_r3699762264
##########
raft/src/test/java/org/apache/kafka/raft/QuorumStateTest.java:
##########
@@ -2514,14 +2541,31 @@ public void
testResignedToFollowerInSameEpoch(KRaftVersion kraftVersion) {
int node2 = 2;
int epoch = 5;
VoterSet voters = localWithRemoteVoterSet(IntStream.of(node1, node2),
kraftVersion);
- ElectionState election = ElectionState.withElectedLeader(epoch,
localId, Optional.empty(), voters.voterIds());
+ ElectionState election = ElectionState.withElectedLeader(
+ epoch,
+ localId,
+ Optional.of(localVoterKey),
+ voters.voterIds()
+ );
store.writeElectionState(election, kraftVersion);
QuorumState state = buildQuorumState(OptionalInt.of(localId), voters,
kraftVersion);
state.initialize(new OffsetAndEpoch(0L, logEndEpoch));
assertTrue(state.isResigned());
- assertThrows(IllegalStateException.class, () ->
state.transitionToFollower(epoch, localId, voters.listeners(localId)));
+ assertThrows(
+ IllegalStateException.class,
+ () -> state.transitionToFollower(epoch, localId,
voters.listeners(localId))
+ );
// KAFKA-18379 will fix this
Review Comment:
Follow-up: I removed the stale KAFKA-18379 comment in the latest commit
because it is unrelated to this PR. The branch now contains only the votedKey
preservation change and its focused regression coverage. Please resolve this
thread if the cleanup is acceptable.
--
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]