-
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
[ISSUE 7758]Support set Max Producer on topic level #7839
Conversation
/pulsarbot run-failure-checks |
log.info("MaxProducers: {} get on topic: {}", getMaxProducers, testTopic); | ||
Assert.assertEquals(getMaxProducers, maxProducers); | ||
|
||
admin.topics().removeMaxProducers(testTopic); |
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.
How about change this test into this logic:
- maxProducers = 2;
- after set, can only create 2 producers;
- after remove, can create more than 2 producers;
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 change it.
@@ -337,4 +338,80 @@ public void testRemovePersistence() throws Exception { | |||
|
|||
admin.topics().deletePartitionedTopic(testTopic, true); | |||
} | |||
|
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.
Maybe we should also consider add test along with policies in namespace?
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.
@@ -2352,6 +2352,50 @@ protected void internalGetPersistence(AsyncResponse asyncResponse){ | |||
return pulsar().getTopicPoliciesService().updateTopicPoliciesAsync(topicName, topicPolicies.get()); | |||
} | |||
|
|||
protected void internalGetMaxProducers(AsyncResponse asyncResponse){ | |||
validateAdminAccessForTenant(namespaceName.getTenant()); |
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.
Call checkTopicLevelPolicyEnable()
before use topic policy API, please check all.
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.
@@ -2352,6 +2352,50 @@ protected void internalGetPersistence(AsyncResponse asyncResponse){ | |||
return pulsar().getTopicPoliciesService().updateTopicPoliciesAsync(topicName, topicPolicies.get()); | |||
} | |||
|
|||
protected void internalGetMaxProducers(AsyncResponse asyncResponse){ |
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.
How about make the method name more clear and align with namespace policies?
e.g. add "PerTopic" at the end: "xxxMaxProducersPerTopic"
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.
Now it is the policies for a single topic, namespaces policies can take control of all the topics of the namespace, so 'perTopic' is suitable, but at the topic level, just set to only one topic, so I remove the 'perTopic' in all methods.
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.
Thanks @zhanghaou for the help, overall lgtm. left some comments related to the test and method names.
…ic-level # Conflicts: # pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java # pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/Topics.java
/pulsarbot run-failure-checks |
4 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
Link #7758 and master issue #2688
Motivation
Support set/get/remove maxProducers on a topic level.
Verifying this change
new unit test added.