aloknnikhil commented on a change in pull request #9916:
URL: https://github.com/apache/kafka/pull/9916#discussion_r561327703
##########
File path: raft/src/test/java/org/apache/kafka/raft/RaftTestUtil.java
##########
@@ -35,24 +35,10 @@ public static RaftConfig buildRaftConfig(
int appendLingerMs,
List<Node> voterNodes
) {
- Properties properties = new Properties();
- properties.put(RaftConfig.QUORUM_REQUEST_TIMEOUT_MS_CONFIG,
requestTimeoutMs);
- properties.put(RaftConfig.QUORUM_RETRY_BACKOFF_MS_CONFIG,
retryBackoffMs);
- properties.put(RaftConfig.QUORUM_ELECTION_TIMEOUT_MS_CONFIG,
electionTimeoutMs);
- properties.put(RaftConfig.QUORUM_ELECTION_BACKOFF_MAX_MS_CONFIG,
electionBackoffMs);
- properties.put(RaftConfig.QUORUM_FETCH_TIMEOUT_MS_CONFIG,
fetchTimeoutMs);
- properties.put(RaftConfig.QUORUM_LINGER_MS_CONFIG, appendLingerMs);
-
- StringBuilder votersString = new StringBuilder();
- String prefix = "";
- for (Node voter : voterNodes) {
- votersString.append(prefix);
-
votersString.append(voter.id()).append('@').append(voter.host()).append(':').append(voter.port());
- prefix = ",";
- }
- properties.put(RaftConfig.QUORUM_VOTERS_CONFIG,
votersString.toString());
-
- return new RaftConfig(properties);
+ Map<Integer, InetSocketAddress> voterConnections = voterNodes.stream()
+ .collect(Collectors.toMap(Node::id, node -> new
InetSocketAddress(node.host(), node.port())));
+ return new RaftConfig(voterConnections, requestTimeoutMs,
retryBackoffMs, electionTimeoutMs, electionBackoffMs,
Review comment:
You're right. This is an artifact from the previous constructor usage.
Fixed.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]