-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix wrong result for looking up a non-exist topic by rest api #13055
Conversation
@aloyszhang:Thanks for your contribution. For this PR, do we need to update docs? |
@aloyszhang:Thanks for providing doc info! |
7e60ab6
to
15aff2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aloyszhang It will be a breaking change if users use HTTP lookup of the client and enable topic auto-creation
@codelipenghui yes, I found this problem in the unit test too. |
15aff2d
to
ccf6bff
Compare
/pulsarbot run-failure-checks |
pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonPersistentTopicTest.java
Show resolved
Hide resolved
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
Outdated
Show resolved
Hide resolved
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/pulsarbot run-failure-checks |
@codelipenghui PTAL, thanks ! |
I don't think this will actually break an application, as eventually user will first produce to then consume from a topic to make use of it, and if topic auto creation is enabled topic will be created anyway, so that should be fine. |
pulsar-broker/src/main/java/org/apache/pulsar/broker/lookup/TopicLookupBase.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall lgtm
But there is a change in a test case that smells
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TopicDoesNotExistsTest.java
Show resolved
Hide resolved
cc@eolivelli |
@eolivelli if there's no objection, I think we can merge this to the master branch. PTAL, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
…#13055) Fixes apache#13028 ### Motivation For now, the result of the `lookup` command for a topic not existing by the rest API will return a brokerUrl. This pull request resolves this problem. ### Modifications Add topic exist check before get the brokerUrl 1. if not exist, return a ResetException with status code NOT_FOUND 2. if exist, get the brokerUrl ### Verifying this change This change added tests and can be verified as follows: HttpTopicLookupv2Test.testLookupTopicNotExist
Fixes #13028
Motivation
For now, the result of the
lookup
command for a topic not existing by the rest API will return a brokerUrl.This pull request resolves this problem.
Modifications
Add topic exist check before get the brokerUrl
Verifying this change
This change added tests and can be verified as follows:
HttpTopicLookupv2Test.testLookupTopicNotExist
Documentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
doc-required
(If you need help on updating docs, create a doc issue)
no-need-doc
(Please explain why)
doc
(If this PR contains doc changes)