Skip to content

[KAFKA-7054] Kafka describe command should throw topic doesn't exist exception. - #5211

Closed
ManoharVanam wants to merge 1 commit into
apache:trunkfrom
ManoharVanam:KAFKA-7054
Closed

[KAFKA-7054] Kafka describe command should throw topic doesn't exist exception.#5211
ManoharVanam wants to merge 1 commit into
apache:trunkfrom
ManoharVanam:KAFKA-7054

Conversation

@ManoharVanam

@ManoharVanam ManoharVanam commented Jun 13, 2018

Copy link
Copy Markdown
Contributor

User Interface Improvement : If topic doesn't exist then Kafka describe command should throw topic doesn't exist exception, like alter and delete commands

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@ManoharVanam
ManoharVanam force-pushed the KAFKA-7054 branch 2 times, most recently from bd9f285 to 70de736 Compare June 13, 2018 13:06
@vahidhashemian

Copy link
Copy Markdown
Contributor

Thanks for the PR. The current implementation does not report anything when a non-existing topic is described. So reporting some message/error would be a good addition IMO. I think however a simple message would probably be better. The consumer group command reports a message like this when the group to describe does not exist:

Error: Consumer group 'abcd' does not exist.

Perhaps something similar for the topic command?
Also, note that the topic command accepts regex too for the --topic argument.

@ManoharVanam

Copy link
Copy Markdown
Contributor Author

@vahidhashemian actually I checked alter & delete topic commands, In case of non-existing topic both returns below error. So for maintaining consistency, I added the same check for topic describe command.
[ERROR java.lang.IllegalArgumentException: Topic abcd does not exist on ZK path localhost:2181]

@vahidhashemian

Copy link
Copy Markdown
Contributor

@ManoharVanam It makes sense. We are not consistent with respect to error handling across the command line tools. Could you please add some unit test for this improvement? Thanks!

@ManoharVanam ManoharVanam changed the title [KAFKA-7054] Kafka describe command should throw topic doesn't exist exception [KAFKA-7054] Kafka describe command should throw topic doesn't exist exception. Jun 20, 2018
@ManoharVanam

Copy link
Copy Markdown
Contributor Author

@vahidhashemian Done.

@vahidhashemian vahidhashemian 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.

LGTM, thanks for the PR.

@ManoharVanam

Copy link
Copy Markdown
Contributor Author

retest this please

@ManoharVanam

Copy link
Copy Markdown
Contributor Author

@mjsax @ijuma

@mjsax

mjsax commented Jun 25, 2018

Copy link
Copy Markdown
Member

\cc @hachikuji -- I am not familiar with this part of the code base.

@hachikuji hachikuji 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 patch. I agree we should be consistent. Left a minor suggestion.

Comment thread core/src/main/scala/kafka/admin/TopicCommand.scala Outdated
@ManoharVanam

Copy link
Copy Markdown
Contributor Author

@hachikuji Done.

@ManoharVanam

Copy link
Copy Markdown
Contributor Author

@hachikuji Moved common code to utils.

@ManoharVanam

Copy link
Copy Markdown
Contributor Author

retest this please

@omkreddy

Copy link
Copy Markdown
Contributor

We need to update the --if-exists option description at line no:362 and valid check at line no:397

@omkreddy omkreddy 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.

@ManoharVanam Thanks for the PR. I just left couple of comments.

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.

Can we move this line to ensureTopicExists() method here? Same applies to other methods also

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.

@omkreddy Thanks for reviewing this PR, Currently describe command is not supporting --if-exists option so added the same as per your suggestion, but after adding this option we need to check both topic opt and if-exists option, so due to this change Im not moving this check to ensureTopicExists method.

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.

Can we also verify the behavior with --if--exists flag. similar to this

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.

Ok, added scenario with --if--exists flag

@ManoharVanam

Copy link
Copy Markdown
Contributor Author

retest this please

@omkreddy omkreddy 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.

@ManoharVanam Thanks for the PR. LGTM.

@omkreddy

Copy link
Copy Markdown
Contributor

retest this please

1 similar comment
@omkreddy

Copy link
Copy Markdown
Contributor

retest this please

@omkreddy omkreddy closed this in 5533445 Dec 21, 2018
pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
…xception

**User Interface Improvement :** If topic doesn't exist then Kafka describe command should throw topic doesn't exist exception, like alter and delete commands

Author: Manohar Vanam <manohar.crazy09@gmail.com>

Reviewers: Vahid Hashemian <vahid.hashemian@gmail.com>, Jason Gustafson <jason@confluent.io>, Manikumar Reddy <manikumar.reddy@gmail.com>

Closes apache#5211 from ManoharVanam/KAFKA-7054
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants