Skip to content

KAFKA-20734: Return noNode for known partitions without endpoints - #22680

Open
xiaoqingwanga wants to merge 3 commits into
apache:trunkfrom
xiaoqingwanga:fix/metadata-cache-leader-missing
Open

xiaoqingwanga wants to merge 3 commits into
apache:trunkfrom
xiaoqingwanga:fix/metadata-cache-leader-missing

Conversation

@xiaoqingwanga

@xiaoqingwanga xiaoqingwanga commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

In KRaftMetadataCache, getPartitionLeaderEndpoint returns empty when the previous leader is offline after the refactor.

With this PR, the method now returns noNode when the leader partition exists, aligning with the original Scala implementation.

Changes are covered by unit tests. Please feel free to review.

Reviewers: Kevin Wu kwu@confluent.io

@github-actions github-actions Bot added triage PRs from the community kraft small Small PRs labels Jun 26, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

@jolshan jolshan reopened this Oct 21, 2026
@jolshan jolshan removed triage PRs from the community needs-attention labels Oct 21, 2026
@github-actions github-actions Bot added the triage PRs from the community label Oct 21, 2026
@github-actions

Copy link
Copy Markdown

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

@kevin-wu24 kevin-wu24 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix @xiaoqingwanga. I left some comments on the test.

Comment on lines +515 to +519
new RegisterBrokerRecord()
.setBrokerId(0)
.setBrokerEpoch(BROKER_EPOCH)
.setFenced(false)
.setEndPoints(new BrokerEndpointCollection(List.of(

@kevin-wu24 kevin-wu24 Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we need to also add .setRack(null) to make this test pass. Otherwise the first assertion fails.

Comment on lines +430 to +431
.flatMap(broker -> broker.node(listenerName.value()))
.orElse(Node.noNode()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: remove extra indentation.

@github-actions github-actions Bot added core Kafka Broker and removed small Small PRs labels Oct 23, 2026
@xiaoqingwanga

Copy link
Copy Markdown
Contributor Author

Hi, the comments are resolved. Please review again @kevin-wu24

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

Labels

core Kafka Broker kraft needs-attention triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants