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

[ISSUE 7758] Support set Max Producer on topic level. #7914

Merged
merged 8 commits into from
Sep 3, 2020
Merged

[ISSUE 7758] Support set Max Producer on topic level. #7914

merged 8 commits into from
Sep 3, 2020

Conversation

zhanghaou
Copy link
Contributor

Link #7758 and master issue #2688

Motivation

Support set/get/remove maxProducers on a topic level.

Verifying this change

new unit test added.

zhanghaou and others added 3 commits August 27, 2020 09:15
# Conflicts:
#	pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java
@zhanghaou
Copy link
Contributor Author

link #7839 PTAL @zhaijack @codelipenghui

@codelipenghui
Copy link
Contributor

@jianyun8023 please help review this PR

@codelipenghui codelipenghui added component/topic-policy doc-required Your PR changes impact docs and you will update later. labels Aug 28, 2020
@codelipenghui codelipenghui added this to the 2.7.0 milestone Aug 28, 2020
zhanghaou and others added 2 commits August 31, 2020 09:04
# Conflicts:
#	pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesDisableTest.java
#	pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/Topics.java
#	pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TopicsImpl.java
#	pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
@zhanghaou
Copy link
Contributor Author

/pulsarbot run-failure-checks

Copy link
Contributor

@jianyun8023 jianyun8023 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Comment on lines +2374 to +2388
protected void internalGetMaxProducers(AsyncResponse asyncResponse) {
validateAdminAccessForTenant(namespaceName.getTenant());
validatePoliciesReadOnlyAccess();
if (topicName.isGlobal()) {
validateGlobalNamespaceOwnership(namespaceName);
}
checkTopicLevelPolicyEnable();
Optional<Integer> maxProducers = getTopicPolicies(topicName)
.map(TopicPolicies::getMaxProducerPerTopic);
if (!maxProducers.isPresent()) {
asyncResponse.resume(Response.noContent().build());
} else {
asyncResponse.resume(maxProducers.get());
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please return CompletableFuture< Integer > instead of passing in AsyncResponse.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or directly return Integer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems some methods similar to this also need to modify, can we modify it all?

zhanghaou and others added 3 commits September 3, 2020 08:03
# Conflicts:
#	pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesDisableTest.java
#	pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/Topics.java
#	pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TopicsImpl.java
#	pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
@codelipenghui codelipenghui merged commit 2e88fdb into apache:master Sep 3, 2020
@zhanghaou zhanghaou deleted the set-max-producer branch September 3, 2020 09:10
lbenc135 pushed a commit to lbenc135/pulsar that referenced this pull request Sep 5, 2020
Link [apache#7758 and master issue [apache#2688

### Motivation

Support set/get/remove maxProducers on a topic level.
lbenc135 pushed a commit to lbenc135/pulsar that referenced this pull request Sep 5, 2020
Link [apache#7758 and master issue [apache#2688

### Motivation

Support set/get/remove maxProducers on a topic level.
lbenc135 pushed a commit to lbenc135/pulsar that referenced this pull request Sep 5, 2020
Link [apache#7758 and master issue [apache#2688

### Motivation

Support set/get/remove maxProducers on a topic level.
@codelipenghui codelipenghui mentioned this pull request Sep 5, 2020
14 tasks
@Anonymitaet Anonymitaet added doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. and removed doc-required Your PR changes impact docs and you will update later. labels Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants