Skip to content

Add maxUnackedMessagesPerSubscription and maxUnackedMessagesPerConsumer on namespaces policies #5936

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

Merged

Conversation

wolfstudy
Copy link
Member

@wolfstudy wolfstudy commented Dec 25, 2019

Signed-off-by: xiaolong.ran [email protected]

Master Issue: #2939

Modifications

  • add get-max-unacked-messages-per-subscription on namespaces policies
  • add set-max-unacked-messages-per-subscription on namespaces policies
  • add get-max-unacked-messages-per-consumer on namespaces policies
  • add set-max-unacked-messages-per-consumer on namespaces policies
  • update admin cli docs
  • add test case

…er on namespaces policies

Signed-off-by: xiaolong.ran <[email protected]>
Signed-off-by: xiaolong.ran <[email protected]>
Signed-off-by: xiaolong.ran <[email protected]>
@wolfstudy
Copy link
Member Author

@sijie @jiazhai @codelipenghui PTAL thanks.

Copy link
Contributor

@codelipenghui codelipenghui left a comment

Choose a reason for hiding this comment

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

I think we need to handle policies update events(https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L1291). Otherwise we need unload namespace or restart broker to let the new settings take effect.

Signed-off-by: xiaolong.ran <[email protected]>
Signed-off-by: xiaolong.ran <[email protected]>
@wolfstudy
Copy link
Member Author

@codelipenghui PTAL thanks.

@wolfstudy
Copy link
Member Author

ping @codelipenghui PTAL again, thanks.

@sijie
Copy link
Member

sijie commented Jan 13, 2020

run java8 tests

@sijie
Copy link
Member

sijie commented Jan 13, 2020

@codelipenghui can you review this pull request?

@codelipenghui
Copy link
Contributor

@sijie I took a look, maybe not solve my previous comment. I think @wolfstudy can add a unit test to ensure the dispatcher can handle the policy update. because your current unit test works on zookeeper (write policy data to zookeeper and get policy data from zookeeper), this does not ensure that the dispatcher can work well with policy update.

@sijie
Copy link
Member

sijie commented Jan 18, 2020

@wolfstudy can you please take a look at @codelipenghui 's comments?

@wolfstudy
Copy link
Member Author

@wolfstudy can you please take a look at @codelipenghui 's comments?

Of course, will fix it

@@ -454,6 +454,14 @@ protected void mergeNamespaceWithDefaults(Policies policies, String namespace, S
policies.max_consumers_per_subscription = config.getMaxConsumersPerSubscription();
}

if (policies.max_unacked_messages_per_consumer < 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (policies.max_unacked_messages_per_consumer < 1) {
if (policies.max_unacked_messages_per_consumer == -1) {

policies.max_unacked_messages_per_consumer = config.getMaxUnackedMessagesPerConsumer();
}

if (policies.max_unacked_messages_per_subscription < 1) {
Copy link
Contributor

@codelipenghui codelipenghui Jan 20, 2020

Choose a reason for hiding this comment

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

Suggested change
if (policies.max_unacked_messages_per_subscription < 1) {
if (policies.max_unacked_messages_per_subscription == -1) {

Copy link
Contributor

@codelipenghui codelipenghui 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, just a minor comment about merge polices method when get polices

@codelipenghui
Copy link
Contributor

@sijie I suggest @wolfstudy to change the default value of maxUnackedMessagesPerSubscription and maxUnackMessagesPerConsumer to -1 in namespace policy, because 0 means disabled in broker.conf. Only non negative value can update policy when broker get policy update notifications. Please help take a look.

Signed-off-by: xiaolong.ran <[email protected]>
@wolfstudy
Copy link
Member Author

ping @sijie PTAL thanks

Signed-off-by: xiaolong.ran <[email protected]>
@wolfstudy
Copy link
Member Author

run java8 tests

1 similar comment
@wolfstudy
Copy link
Member Author

run java8 tests

@sijie sijie added the doc-required Your PR changes impact docs and you will update later. label Jan 22, 2020
Signed-off-by: xiaolong.ran <[email protected]>
@wolfstudy
Copy link
Member Author

@sijie the docs fixed done, PTAL

@wolfstudy
Copy link
Member Author

run integration tests
run java8 tests

@codelipenghui
Copy link
Contributor

retest this please

@codelipenghui
Copy link
Contributor

run java8 tests

@wolfstudy
Copy link
Member Author

run java8 tests

1 similar comment
@wolfstudy
Copy link
Member Author

run java8 tests

@wolfstudy
Copy link
Member Author

org.apache.pulsar.broker.admin.AdminApiOffloadTest.testOffloadV1
org.apache.pulsar.broker.admin.AdminApiTest.namespaces
org.apache.pulsar.broker.admin.v1.V1_AdminApiTest.namespaces
org.apache.pulsar.client.api.DispatcherBlockConsumerTest.testBlockDispatcherStats

run java8 tests

Signed-off-by: xiaolong.ran <[email protected]>
Signed-off-by: xiaolong.ran <[email protected]>
Signed-off-by: xiaolong.ran <[email protected]>
@wolfstudy wolfstudy merged commit 4ea02a3 into apache:master Feb 3, 2020
@wolfstudy wolfstudy deleted the xiaolong/add-unack-message-per-consumer branch February 3, 2020 14:10
@sijie sijie added this to the 2.6.0 milestone Feb 16, 2020
@Anonymitaet Anonymitaet removed the doc-required Your PR changes impact docs and you will update later. label Jun 10, 2020
@Anonymitaet
Copy link
Member

huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
…er on namespaces policies (apache#5936)

* Add maxUnackedMessagesPerSubscription and maxUnackedMessagesPerConsumer on namespaces policies

Signed-off-by: xiaolong.ran <[email protected]>

* update admin cli docs

Signed-off-by: xiaolong.ran <[email protected]>

* add test case

Signed-off-by: xiaolong.ran <[email protected]>

* fix comments

Signed-off-by: xiaolong.ran <[email protected]>

* add test case for max unacked messages

Signed-off-by: xiaolong.ran <[email protected]>

* fix comments

Signed-off-by: xiaolong.ran <[email protected]>

* fix no space issue

Signed-off-by: xiaolong.ran <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants