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

[Bug] Topic Lookup on non-existent topics unexpected response. #13028

Closed
ronfarkash opened this issue Nov 29, 2021 · 2 comments · Fixed by #13055
Closed

[Bug] Topic Lookup on non-existent topics unexpected response. #13028

ronfarkash opened this issue Nov 29, 2021 · 2 comments · Fixed by #13055
Assignees
Labels
type/bug The PR fixed a bug or issue reported a bug

Comments

@ronfarkash
Copy link
Contributor

ronfarkash commented Nov 29, 2021

Describe the bug
When using the Rest API to look up a topic
http://{broker}/lookup/v2/topic/persistent/{tenant}/{namespace}/{topic}
on a topic that does not exist, two things can happen:

  1. I receive a redirect (307) to another broker
  2. I receive a response (200) containing a broker

To Reproduce
Steps to reproduce the behavior:

  1. Setup a normal cluster, BookKeeper/ZooKeeper/Configuration Store/2+ Brokers
  2. Look for a topic that does not exist using http://{broker}/lookup/v2/topic/persistent/{tenant}/{namespace}/{topic}
  3. See a response as if the topic exists.

Expected behavior
I expect to receive 404 Topic not found.

Desktop (please complete the following information):

  • OS: Linux (KDE Neon 5.21 User Edition)

Additional Context
To my understanding when performing Rest API requests for topics/namespaces (anything related to ownership) the broker will first check if it owns the object you were referring to, else it will return a redirect (307) to the broker who owns the topic.
In this case the Topic does not exist, therefore I should not get a 200 with a broker name, I should instead get 404 not found.

@ronfarkash ronfarkash added the type/bug The PR fixed a bug or issue reported a bug label Nov 29, 2021
@ronfarkash ronfarkash changed the title [Bug] [Bug] Topic Lookup on non-existent topics unexpected response. Nov 29, 2021
@aloyszhang
Copy link
Contributor

aloyszhang commented Nov 29, 2021

I can help with this problem.
@ronfarkash Can you provide which verison of pulsar you used ?

@ronfarkash
Copy link
Contributor Author

I can help with this problem. @ronfarkash Can you provide which verison of pulsar you used ?

2.8.1

BewareMyPower pushed a commit that referenced this issue Dec 14, 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
fxbing pushed a commit to fxbing/pulsar that referenced this issue 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants