Skip to content

KAFKA-20089 : clients - update javadocs -- while topic being created in background#21959

Merged
chia7712 merged 3 commits intoapache:trunkfrom
muralibasani:KAFKA-20089
Apr 9, 2026
Merged

KAFKA-20089 : clients - update javadocs -- while topic being created in background#21959
chia7712 merged 3 commits intoapache:trunkfrom
muralibasani:KAFKA-20089

Conversation

@muralibasani
Copy link
Copy Markdown
Contributor

@muralibasani muralibasani commented Apr 4, 2026

https://issues.apache.org/jira/browse/KAFKA-20089

Changing the error code needs a kip. For now updating javadocs. A kip
will be proposed later.

Reviewers: Chia-Ping Tsai chia7712@gmail.com

@github-actions github-actions bot added triage PRs from the community core Kafka Broker small Small PRs labels Apr 4, 2026
@muralibasani muralibasani changed the title KAFKA-20089 : Change error code to leader not avaialble while topic being created KAFKA-20089 : core - Change error code to leader not avaialble while topic being created Apr 5, 2026
@muralibasani
Copy link
Copy Markdown
Contributor Author

@chia7712 may I request your review pls.

val creatableTopicResponses = creatableTopics.keySet.toSeq.map { topic =>
new MetadataResponseTopic()
.setErrorCode(Errors.UNKNOWN_TOPIC_OR_PARTITION.code)
.setErrorCode(Errors.LEADER_NOT_AVAILABLE.code)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Modifying the returned error likely requires a KIP. For now, my preference is to simply update the partitionsFor javadoc. It might cause some friction for users who treated the ZK-mode bug as a feature, but it aligns better with the intended API contract.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I mean, some users tend to rely on this non-standard behavior, and it's time we wake them up :)

Copy link
Copy Markdown
Contributor Author

@muralibasani muralibasani Apr 5, 2026

Choose a reason for hiding this comment

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

Got it. I shall revert the code and add this javadoc to partitionsFor in KafkaConsumer

  • @return The list of partitions, which will be empty when the given topic is not found.
  • Note: when {@code auto.create.topics.enable} is {@code true}, this method may
  • return an empty list even though the topic is being auto-created in the background.
  • Callers should not assume the topic does not exist based solely on an empty result.

Is this ok?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I’d give it an 11/10

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Pushed that javadoc.

@muralibasani muralibasani changed the title KAFKA-20089 : core - Change error code to leader not avaialble while topic being created KAFKA-20089 : clients - Change error code to leader not avaialble while topic being created Apr 5, 2026
@muralibasani muralibasani changed the title KAFKA-20089 : clients - Change error code to leader not avaialble while topic being created KAFKA-20089 : clients - update javadocs -- while topic being created in background Apr 5, 2026
@github-actions github-actions bot removed the triage PRs from the community label Apr 6, 2026
@muralibasani muralibasani requested a review from chia7712 April 6, 2026 08:52
Copy link
Copy Markdown
Contributor

@nileshkumar3 nileshkumar3 left a comment

Choose a reason for hiding this comment

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

Thanks for the documentation update. LGTM !

*
* @return The list of partitions, which will be empty when the given topic is not found
* @return The list of partitions, which will be empty when the given topic is not found.
* Note: when {@code auto.create.topics.enable} is {@code true}, this method may
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should it mention allow.auto.create.topics as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. Updated.

*
* @return The list of partitions, which will be empty when the given topic is not found
* @return The list of partitions, which will be empty when the given topic is not found.
* Note: when {@code auto.create.topics.enable} is {@code true}, this method may
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@chia7712 chia7712 merged commit 6f4b47d into apache:trunk Apr 9, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants