Skip to content
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

Merged
merged 5 commits into from
Dec 14, 2021

Conversation

aloyszhang
Copy link
Contributor

@aloyszhang aloyszhang commented Nov 30, 2021

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

  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

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)

@github-actions
Copy link

@aloyszhang:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions
Copy link

@aloyszhang:Thanks for providing doc info!

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Nov 30, 2021
Copy link
Contributor

@MarvinCai MarvinCai left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@codelipenghui codelipenghui left a 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

@aloyszhang
Copy link
Contributor Author

@codelipenghui yes, I found this problem in the unit test too.

@aloyszhang
Copy link
Contributor Author

/pulsarbot run-failure-checks

@aloyszhang
Copy link
Contributor Author

/pulsarbot run-failure-checks

2 similar comments
@aloyszhang
Copy link
Contributor Author

/pulsarbot run-failure-checks

@aloyszhang
Copy link
Contributor Author

/pulsarbot run-failure-checks

Copy link
Contributor

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

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

LGTM

@aloyszhang
Copy link
Contributor Author

/pulsarbot run-failure-checks

@aloyszhang
Copy link
Contributor Author

@codelipenghui PTAL, thanks !

@MarvinCai
Copy link
Contributor

MarvinCai commented Dec 7, 2021

@aloyszhang It will be a breaking change if users use HTTP lookup of the client and enable topic auto-creation

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.

@aloyszhang
Copy link
Contributor Author

cc @congbobo184 @BewareMyPower

Copy link
Contributor

@eolivelli eolivelli left a 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

@aloyszhang
Copy link
Contributor Author

cc@eolivelli

@aloyszhang
Copy link
Contributor Author

aloyszhang commented Dec 12, 2021

@eolivelli if there's no objection, I think we can merge this to the master branch. PTAL, thanks!

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

+1

@BewareMyPower BewareMyPower added this to the 2.10.0 milestone Dec 14, 2021
@BewareMyPower BewareMyPower merged commit c94c81c into apache:master Dec 14, 2021
fxbing pushed a commit to fxbing/pulsar that referenced this pull request Dec 19, 2021
…#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
@aloyszhang aloyszhang deleted the fix-lookup-result branch January 20, 2022 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/admin area/broker doc-not-needed Your PR changes do not impact docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Topic Lookup on non-existent topics unexpected response.
8 participants