kevin-wu24 commented on code in PR #18987:
URL: https://github.com/apache/kafka/pull/18987#discussion_r2006049419
##########
raft/src/test/java/org/apache/kafka/raft/RaftEventSimulationTest.java:
##########
@@ -645,39 +837,56 @@ private static class Cluster {
final AtomicInteger correlationIdCounter = new AtomicInteger();
final MockTime time = new MockTime();
final String clusterId = Uuid.randomUuid().toString();
- final Map<Integer, Node> voters = new HashMap<>();
- final Map<Integer, PersistentState> nodes = new HashMap<>();
+ final Map<Integer, Node> initialVoters = new HashMap<>();
+ final Map<Integer, PersistentState> persistentStates = new HashMap<>();
final Map<Integer, RaftNode> running = new HashMap<>();
+ final boolean withKip853;
- private Cluster(int numVoters, int numObservers, Random random) {
+ private Cluster(int numVoters, int numObservers, Random random,
boolean withKip853) {
this.random = random;
+ this.withKip853 = withKip853;
for (int nodeId = 0; nodeId < numVoters; nodeId++) {
- voters.put(nodeId, nodeFromId(nodeId));
- nodes.put(nodeId, new PersistentState(nodeId));
+ initialVoters.put(nodeId, nodeFromId(nodeId));
+ persistentStates.put(nodeId, new PersistentState(nodeId));
}
for (int nodeIdDelta = 0; nodeIdDelta < numObservers;
nodeIdDelta++) {
int nodeId = numVoters + nodeIdDelta;
- nodes.put(nodeId, new PersistentState(nodeId));
+ persistentStates.put(nodeId, new PersistentState(nodeId));
}
}
Set<InetSocketAddress> endpointsFromIds(Set<Integer> nodeIds) {
- return voters
+ return running
.values()
.stream()
- .filter(node -> nodeIds.contains(node.id()))
+ .filter(node -> nodeIds.contains(node.nodeId))
.map(Cluster::nodeAddress)
.collect(Collectors.toSet());
}
+ Optional<VoterSet> initialVoterSetFromIds() {
Review Comment:
Yeah, the IDs from `initialVoterSet`. Initially, this function returned an
empty `Optional` when KIP-853 was not enabled, which is what Alyssa was
referring to.
--
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]