lh0156 commented on code in PR #22203:
URL: https://github.com/apache/kafka/pull/22203#discussion_r3251595728


##########
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:
   I think this comment is still relevant because KAFKA-18379 is a separate 
open issue about preventing Resigned -> Follower transitions in the same epoch. 
I left it unchanged to keep this PR scoped to preserving votedKey.



-- 
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]

Reply via email to