-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
support namespace policy for maxTopicsPerNamespace limit #9042
support namespace policy for maxTopicsPerNamespace limit #9042
Conversation
@315157973 Could you please help review this PR? |
Integer maxTopicsPerNamespace; | ||
try { | ||
maxTopicsPerNamespace = getNamespacePolicies(namespaceName).max_topics_per_namespace; | ||
if (maxTopicsPerNamespace == null || maxTopicsPerNamespace < 0) { |
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.
When setting the value, it must be greater than or equal to 0, so there should be no case of <0.
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.
OK, maxTopicsPerNamespace
is get from namespace policy, it must be greater than 0, i update the code.
validateNamespacePolicyOperation(namespaceName, PolicyName.MAX_TOPICS, PolicyOperation.WRITE); | ||
validatePoliciesReadOnlyAccess(); | ||
|
||
if (maxTopicsPerNamespace != null && maxTopicsPerNamespace < 0) { |
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.
When setting the value, it must be greater than or equal to 0, so there should be no case of <0.
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.
The maxTopicsPerNamespace
is passed by user, we should forbid user set the value < 0, so the check must be added.
admin.namespaces().createNamespace(namespace, Sets.newHashSet("use")); | ||
admin.namespaces().setMaxTopicsPerNamespace(namespace, 10); | ||
|
||
pulsarClient.newProducer().topic(topic + "1").create(); |
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.
Will there be a problem if the created producer is not closed?
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.
OK, i will close them.
/pulsarbot run-failure-checks |
.map(p -> p.max_topics_per_namespace) | ||
.orElse(null); | ||
|
||
if (maxTopicsPerNamespace == null || maxTopicsPerNamespace < 0) { |
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.
Will there be no <0?
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.
I remove it.
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
Related to #8225
Changes
maxTopicsPerNamespace
limit