dajac commented on code in PR #12897: URL: https://github.com/apache/kafka/pull/12897#discussion_r1035961196
########## clients/src/main/java/org/apache/kafka/common/Cluster.java: ########## @@ -253,7 +253,11 @@ public Node nodeById(int id) { public Optional<Node> nodeIfOnline(TopicPartition partition, int id) { Node node = nodeById(id); PartitionInfo partitionInfo = partition(partition); - if (node != null && partitionInfo != null && !Arrays.asList(partitionInfo.offlineReplicas()).contains(node)) { + + if (node != null && partitionInfo != null && + !Arrays.asList(partitionInfo.offlineReplicas()).contains(node) && + Arrays.asList(partitionInfo.replicas()).contains(node)) { Review Comment: Could we add or update a test case for this as well? ########## clients/src/test/java/org/apache/kafka/common/requests/RequestTestUtils.java: ########## @@ -208,10 +209,10 @@ public static MetadataResponse metadataUpdateWith(final String clusterId, for (int i = 0; i < numPartitions; i++) { TopicPartition tp = new TopicPartition(topic, i); Node leader = nodes.get(i % nodes.size()); - List<Integer> replicaIds = Collections.singletonList(leader.id()); + List<Integer> replicaIds = nodes.stream().map(Node::id).collect(Collectors.toList()); Review Comment: Why do we need to change this? Is it OK to change for all existing usages? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org