-
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
[Broker] Adjust topic exists check logic in http lookup process #14199
[Broker] Adjust topic exists check logic in http lookup process #14199
Conversation
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. Good catch.
I think we can go further and just skip this exist check if pulsar().getBrokerService().isAllowAutoTopicCreation(topicName)
is true?
The related change introduced by #13055 and only for the master branch, so don't need to cherry-pick to other branches. |
Seems a good idea. @codelipenghui @gaoran10 |
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.
But the idea that @Jason918 commented looks perfect.
@Jason918 @Technoboy- Thanks, I improve the logic, please check the last commit. |
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.
Great.
…he#14199) ### Motivation Currently, it's hard to check the non-persistent-non-partitioned topic exists or not, because it only exists in the broker cache, it doesn't have metadata. If there is a non-persistent and non-partitioned topic exists in broker0 and the configuration `AllowAutoTopicCreation` is false, we perform an HTTP lookup request to broker1, it will return a TopicNotFound exception. ### Modifications If the topic is non-persistent and non-partitioned, we'll return the true flag to ensure the http lookup can return a result. ### Verifying this change Add a test to verify the HTTP lookup request to each broker could return a right lookup result.
Motivation
Currently, it's hard to check the non-persistent-non-partitioned topic exists or not, because it only exists in the broker cache, it doesn't have metadata.
If there is a non-persistent and non-partitioned topic exists in broker0 and the configuration
AllowAutoTopicCreation
is false, we perform an HTTP lookup request to broker1, it will return a TopicNotFound exception.Modifications
If the topic is non-persistent and non-partitioned, we'll return the true flag to ensure the http lookup can return a result.
Verifying this change
Add a test to verify the HTTP lookup request to each broker could return a right lookup result.
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below or label this PR directly (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)