Skip to content

Conversation

@wolfstudy
Copy link
Member

@wolfstudy wolfstudy commented Dec 23, 2019

Signed-off-by: xiaolong.ran rxl@apache.org

Fixes: #4080

Modifications

  • add set-delayed-delivery policy for namespace
  • add set-delayed-delivery-time policy for namespace
  • add test case
  • update admin cli docs

Signed-off-by: xiaolong.ran <rxl@apache.org>
@wolfstudy wolfstudy self-assigned this Dec 23, 2019
@wolfstudy wolfstudy added the type/feature The PR added a new feature or issue requested a new feature label Dec 23, 2019
@wolfstudy wolfstudy added this to the 2.6.0 milestone Dec 23, 2019
@wolfstudy wolfstudy changed the title Allow to enable/disable delayed delivery for messages on namespace [WIP]Allow to enable/disable delayed delivery for messages on namespace Dec 23, 2019
Signed-off-by: xiaolong.ran <rxl@apache.org>
Signed-off-by: xiaolong.ran <rxl@apache.org>
Signed-off-by: xiaolong.ran <rxl@apache.org>
@wolfstudy wolfstudy changed the title [WIP]Allow to enable/disable delayed delivery for messages on namespace Allow to enable/disable delayed delivery for messages on namespace Dec 23, 2019
Signed-off-by: xiaolong.ran <rxl@apache.org>
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 use a single command to enable or disable delay delivery is more convenient.

pulsar-admin namespaces set-delayed-delivery --enable --tick_time_mills 2000 public/default
pulsar-admin namespaces set-delayed-delivery --disable public/default

And we need to add method for get delayed-delivery

pulsar-admin namespaces get-delayed-delivery public/default
{
"enable": true,
"tick_time_mills": 2000
}

BTW, how do we handle exists messages already push to delayed message tracker when disable delayed delivery, send them to consumer immediately?

@SuppressWarnings("checkstyle:MemberName")
public boolean delayed_delivery = true;
@SuppressWarnings("checkstyle:MemberName")
public long delayed_delivery_time = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be delayed_delivery_tick_time

Signed-off-by: xiaolong.ran <rxl@apache.org>
Signed-off-by: xiaolong.ran <rxl@apache.org>
Signed-off-by: xiaolong.ran <rxl@apache.org>
@wolfstudy
Copy link
Member Author

wolfstudy commented Dec 26, 2019

@codelipenghui PTAL again, thanks.

Get

$ ./bin/pulsar-admin namespaces get-delayed-delivery public/default

{
  "tickTime" : 1000,
  "active" : true
}

Set

$ ./bin/pulsar-admin namespaces set-delayed-delivery public/default --enable --time 2s

Signed-off-by: xiaolong.ran <rxl@apache.org>
Signed-off-by: xiaolong.ran <rxl@apache.org>
@wolfstudy
Copy link
Member Author

ping @codelipenghui PTAL again, thanks.

@sijie
Copy link
Member

sijie commented Jan 1, 2020

@codelipenghui can you help review this pull request again?

Comment on lines +1198 to +1199
* "tickTime" : 1000, // Enable or disable delayed delivery for messages on a namespace
* "active" : true, // The tick time for when retrying on delayed delivery messages
Copy link
Contributor

Choose a reason for hiding this comment

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

are the two notes reversed?

Signed-off-by: xiaolong.ran <rxl@apache.org>
@sijie
Copy link
Member

sijie commented Jan 6, 2020

@codelipenghui can you review this change?

@Override
public boolean trackDelayedDelivery(long ledgerId, long entryId, MessageMetadata msgMetadata) {
if (!isDelayedDeliveryEnabled) {
if (!isDelayedDeliveryEnabled || !topic.checkActiveDelayedDelivery()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The isDelayedDeliveryEnabled in the dispatcher is for indicating the dispatcher is enable or disable delayed delivery. It's better to update this field while the delayed delivery policy changed because it's more economic than get policy from a hashmap for each message.

.of(topic.getBrokerService().getDelayedDeliveryTrackerFactory().newTracker(this));
}

delayedDeliveryTracker.get().resetTickTime(topic.checkTickTimeDelayedDelivery());
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above comment, reset tick time when the namespace policy changed is more economic than check need to reset for every message

Signed-off-by: xiaolong.ran <rxl@apache.org>
@wolfstudy
Copy link
Member Author

wolfstudy commented Jan 19, 2020

Sorry, i missed the message.

@codelipenghui fixed done, please take a look again, thanks.

Signed-off-by: xiaolong.ran <rxl@apache.org>
@Override
public boolean trackDelayedDelivery(long ledgerId, long entryId, MessageMetadata msgMetadata) {
if (!isDelayedDeliveryEnabled) {
if (!isDelayedDeliveryEnabled || !topic.delayedDeliveryEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can remove the isDelayedDeliveryEnabled in dispatcher, maybe we just need it on topic level on subscription level

Comment on lines 302 to 303


Copy link
Contributor

Choose a reason for hiding this comment

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

remove these 2 lines

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 left some minor comments, please take a look

Signed-off-by: xiaolong.ran <rxl@apache.org>
Signed-off-by: xiaolong.ran <rxl@apache.org>
@wolfstudy
Copy link
Member Author

retest this please

Signed-off-by: xiaolong.ran <rxl@apache.org>
Signed-off-by: xiaolong.ran <rxl@apache.org>
@wolfstudy
Copy link
Member Author

run java8 tests
run cpp tests

@wolfstudy
Copy link
Member Author

run java8 tests

@wolfstudy wolfstudy merged commit f0d339e into apache:master Jan 21, 2020
@tuteng
Copy link
Member

tuteng commented Mar 21, 2020

Add label release-2.5.1, due #6183 dependency

tuteng pushed a commit to AmateurEvents/pulsar that referenced this pull request Mar 21, 2020
…pache#5915)

* Allow to enable/disable delyed delivery for messages on namespace

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add isDelayedDeliveryEnabled function

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add delayed_delivery_time process logic

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add test case

Signed-off-by: xiaolong.ran <rxl@apache.org>

* update admin cli docs

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* update import lib

Signed-off-by: xiaolong.ran <rxl@apache.org>

* avoid import *

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* remove unuse code

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add test case for delayed delivery messages

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>
(cherry picked from commit f0d339e)
tuteng pushed a commit that referenced this pull request Apr 13, 2020
…5915)

* Allow to enable/disable delyed delivery for messages on namespace

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add isDelayedDeliveryEnabled function

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add delayed_delivery_time process logic

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add test case

Signed-off-by: xiaolong.ran <rxl@apache.org>

* update admin cli docs

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* update import lib

Signed-off-by: xiaolong.ran <rxl@apache.org>

* avoid import *

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* remove unuse code

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add test case for delayed delivery messages

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>
(cherry picked from commit f0d339e)
jiazhai pushed a commit to jiazhai/pulsar that referenced this pull request May 18, 2020
…pache#5915)

* Allow to enable/disable delyed delivery for messages on namespace

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add isDelayedDeliveryEnabled function

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add delayed_delivery_time process logic

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add test case

Signed-off-by: xiaolong.ran <rxl@apache.org>

* update admin cli docs

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* update import lib

Signed-off-by: xiaolong.ran <rxl@apache.org>

* avoid import *

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* remove unuse code

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add test case for delayed delivery messages

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>
(cherry picked from commit f0d339e)
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
…pache#5915)

* Allow to enable/disable delyed delivery for messages on namespace

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add isDelayedDeliveryEnabled function

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add delayed_delivery_time process logic

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add test case

Signed-off-by: xiaolong.ran <rxl@apache.org>

* update admin cli docs

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* update import lib

Signed-off-by: xiaolong.ran <rxl@apache.org>

* avoid import *

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* remove unuse code

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* add test case for delayed delivery messages

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>

* fix comments

Signed-off-by: xiaolong.ran <rxl@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/2.5.1 type/feature The PR added a new feature or issue requested a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to enable/disable delayed deliver on a per-namespace base

5 participants