Skip to content

Conversation

@mingyen066
Copy link
Collaborator

@mingyen066 mingyen066 commented Dec 4, 2025

The description is inconsistent with method leader(). After checking
the code, we always use pass null to TopicPartitionInfo instead of
noNode The current description is inconsistent with the leader()
method. After reviewing the code, we actually pass null to
TopicPartitionInfo instead of using noNode() in KafkaAdminClient

        for (PartitionInfo partitionInfo : partitionInfos) {
            TopicPartitionInfo topicPartitionInfo = new
TopicPartitionInfo(
                partitionInfo.partition(), leader(partitionInfo),
Arrays.asList(partitionInfo.replicas()),
                Arrays.asList(partitionInfo.inSyncReplicas()));
            partitions.add(topicPartitionInfo);
        }

    private Node leader(PartitionInfo partitionInfo) {
        if (partitionInfo.leader() == null ||
partitionInfo.leader().id() == Node.noNode().id())
            return null;
        return partitionInfo.leader();
    }

https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java#L2440-L2454

@github-actions github-actions bot added triage PRs from the community clients small Small PRs labels Dec 4, 2025
Copy link
Contributor

@squah-confluent squah-confluent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few places we pass Node.noNode() in in tools/src/test. We're not very consistent in usage of null vs Node.noNode(). The new param description doesn't look fully accurate either?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients small Small PRs triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants