apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.12k stars 3.57k forks source link

Message has no redelivery count if subscription type is Exclusive or Failover #15836

Open AnonHxy opened 2 years ago

AnonHxy commented 2 years ago

Describe the bug Message.getRedeliveryCount() is always zero if subscription type is Exclusive or Failove. So we can not take advantage of the RedeliveryBackoff which use redeliveryCount as a parameter.

I wander if it's a bug or feature. In other word, why only share or key_share subscription type enable subscription message redelivery tracker to send redelivery, as Line:84:

https://github.com/apache/pulsar/blob/b13d15c4d6d795f33c6ed23f920fabbb3eeaf745/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java#L72-L85

coderzc commented 2 years ago

It seems to be compatible with the cumulative-ackhttps://github.com/apache/pulsar/pull/2508#discussion_r217257441

gaozhangmin commented 2 years ago

@AnonHxy Failover and exclusive sub type need keeping message order, We cannot implement features which would break the message order to these sub type.

AnonHxy commented 2 years ago

However failover and exclusive sub type can also invoke negativeAcknowledge method, which will break the message order. @gaozhangmin

github-actions[bot] commented 2 years ago

The issue had no activity for 30 days, mark with Stale label.

nahguam commented 2 years ago

Hi @gaozhangmin, I understand why we wouldn't want to implement features that break message ordering. However in this case, in all 4 subscription types, we can negative-ack and have the message redelivered out of order. It seems only the redelivery counter is erroneous on two of them. Can you explain how making the counter report the correct number would break message ordering?

github-actions[bot] commented 2 years ago

The issue had no activity for 30 days, mark with Stale label.