You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "thetumbled (via GitHub)" <gi...@apache.org> on 2025/01/17 06:39:24 UTC
[PR] [fix][client] fix retry letter with exclusive mode. [pulsar]
thetumbled opened a new pull request, #23859:
URL: https://github.com/apache/pulsar/pull/23859
### Motivation
- Retry topic relies on the delayed queue feature. Once user call `reconsumeLater` for a message, this message will be produce as a delayed message to the corresponding retry topic.
- Delayed queue feature can only work with shared/key-shared subscription mode, or the delayed message will be dispatched immediately.
Based on the analysis above, we can come to the conclusion that the consumer of the retry topic must be shared/key-shared.
### Modifications
Demand that the subscription type of the retry topic must be shared.
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
*(Please pick either of the following options)*
This change added tests and can be verified as follows:
*(example:)*
- *Added integration tests for end-to-end deployment with large payloads (10MB)*
- *Extended integration test for recovery after broker failure*
### Does this pull request potentially affect one of the following parts:
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry topic with exclusive mode. [pulsar]
Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower commented on code in PR #23859:
URL: https://github.com/apache/pulsar/pull/23859#discussion_r1957934671
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java:
##########
@@ -151,7 +151,7 @@ public CompletableFuture<Consumer<T>> subscribeAsync() {
Math.max(conf.getBatchReceivePolicy().getMaxNumMessages(), conf.getReceiverQueueSize()));
}
CompletableFuture<Void> applyDLQConfig;
- if (conf.isRetryEnable() && conf.getTopicNames().size() > 0) {
+ if (conf.isRetryEnable() && !conf.getTopicNames().isEmpty()) {
Review Comment:
This change is not related to the PR. It's better to revert it or use a separated PR for such small trivial changes.
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java:
##########
@@ -151,7 +151,7 @@ public CompletableFuture<Consumer<T>> subscribeAsync() {
Math.max(conf.getBatchReceivePolicy().getMaxNumMessages(), conf.getReceiverQueueSize()));
}
CompletableFuture<Void> applyDLQConfig;
- if (conf.isRetryEnable() && conf.getTopicNames().size() > 0) {
+ if (conf.isRetryEnable() && !conf.getTopicNames().isEmpty()) {
Review Comment:
This change is not related to the PR. It's better to revert it and use a separated PR for such small trivial changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry topic with exclusive mode. [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #23859:
URL: https://github.com/apache/pulsar/pull/23859#issuecomment-2597891133
> And i have a question: why delayed message do not support exclusive type? is it a task that can't be implemented? or a pending task?
@thetumbled This question has been asked multiple times before and I didn't search for previous answers. I think that one of the reasons is that the semantics of delayed messages hasn't been defined and designed with Failover or Exclusive type.
There's also technical reasons from implementation perspective. Naively adding support for delayed messages would result in a lot of code duplication in the dispatcher implementation classes. Avoiding code duplication would require refactoring of the dispatcher code and there's currently a lot of resistance in doing that. I noticed that when working on PIP-379 that there's a preference to minimize refactoring due to the risk of regressions. The state management in dispatchers isn't that great and there are bugs that pop up when a subtle change is made. I'm currently investigating #23845 and that's some of my observations about the dispatcher code. It's fairly hard to grasp it how it works due to the multiple levels of states that impact the execution. Multiple levels of state result in a vast state space, which isn't great. A better approach would be to minimize the state space. That could be achieved with a simpler execution model that addresses the different states that exist du
e to various hacks that have been added to address issues in the original implementation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry topic with exclusive mode. [pulsar]
Posted by "thetumbled (via GitHub)" <gi...@apache.org>.
thetumbled commented on PR #23859:
URL: https://github.com/apache/pulsar/pull/23859#issuecomment-2662497291
PATL, thanks. @lhotari @BewareMyPower @poorbarcode @dao-jun @codelipenghui @nodece
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry letter with exclusive mode. [pulsar]
Posted by "thetumbled (via GitHub)" <gi...@apache.org>.
thetumbled commented on PR #23859:
URL: https://github.com/apache/pulsar/pull/23859#issuecomment-2597555953
And i have a question: why delayed message do not support exclusive type? is it a task that can't be implemented? or a pending task?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry topic with exclusive mode. [pulsar]
Posted by "thetumbled (via GitHub)" <gi...@apache.org>.
thetumbled commented on PR #23859:
URL: https://github.com/apache/pulsar/pull/23859#issuecomment-2606580425
> > And i have a question: why delayed message do not support exclusive type? is it a task that can't be implemented? or a pending task?
>
> @thetumbled This question has been asked multiple times before and I didn't search for previous answers. I think that one of the reasons is that the semantics of delayed messages hasn't been defined and designed with Failover or Exclusive type. There's also technical reasons from implementation perspective. Naively adding support for delayed messages would result in a lot of code duplication in the dispatcher implementation classes. Avoiding code duplication would require refactoring of the dispatcher code and there's currently a lot of resistance in doing that. I noticed that when working on PIP-379 that there's a preference to minimize refactoring due to the risk of regressions. The state management in dispatchers isn't that great and there are bugs that pop up when a subtle change is made. I'm currently investigating #23845 and that's some of my observations about the dispatcher code. It's fairly hard to grasp it how it works due to the multiple levels of states that impact t
he execution. Multiple levels of state result in a vast state space, which isn't great. A better approach would be to minimize the state space. That could be achieved with a simpler execution model that addresses the different states that exist due to various hacks that have been added to address issues in the original implementation.
I agree with the complexity of the dispatcher. It is too complicate to master this module and it is hard to guarantee that there is nothing wrong when a seemingly good pr is merged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry topic with exclusive mode. [pulsar]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #23859:
URL: https://github.com/apache/pulsar/pull/23859#issuecomment-2664802803
## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/23859?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 74.19%. Comparing base [(`bbc6224`)](https://app.codecov.io/gh/apache/pulsar/commit/bbc62245c5ddba1de4b1e7cee4ab49334bc36277?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`462ea73`)](https://app.codecov.io/gh/apache/pulsar/commit/462ea7398feeb65affcccf7ff200d7ed06aaec11?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 923 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/pulsar/pull/23859?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #23859 +/- ##
============================================
+ Coverage 73.57% 74.19% +0.61%
+ Complexity 32624 31892 -732
============================================
Files 1877 1853 -24
Lines 139502 143872 +4370
Branches 15299 16350 +1051
============================================
+ Hits 102638 106740 +4102
+ Misses 28908 28739 -169
- Partials 7956 8393 +437
```
| [Flag](https://app.codecov.io/gh/apache/pulsar/pull/23859/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [inttests](https://app.codecov.io/gh/apache/pulsar/pull/23859/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.75% <100.00%> (+2.17%)` | :arrow_up: |
| [systests](https://app.codecov.io/gh/apache/pulsar/pull/23859/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `23.20% <33.33%> (-1.12%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pulsar/pull/23859/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.71% <100.00%> (+0.86%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/23859?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...va/org/apache/pulsar/client/impl/ConsumerBase.java](https://app.codecov.io/gh/apache/pulsar/pull/23859?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FConsumerBase.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL0NvbnN1bWVyQmFzZS5qYXZh) | `75.72% <100.00%> (+1.59%)` | :arrow_up: |
... and [1040 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/23859/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry topic with exclusive mode. [pulsar]
Posted by "thetumbled (via GitHub)" <gi...@apache.org>.
thetumbled commented on code in PR #23859:
URL: https://github.com/apache/pulsar/pull/23859#discussion_r1958971688
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java:
##########
@@ -151,7 +151,7 @@ public CompletableFuture<Consumer<T>> subscribeAsync() {
Math.max(conf.getBatchReceivePolicy().getMaxNumMessages(), conf.getReceiverQueueSize()));
}
CompletableFuture<Void> applyDLQConfig;
- if (conf.isRetryEnable() && conf.getTopicNames().size() > 0) {
+ if (conf.isRetryEnable() && !conf.getTopicNames().isEmpty()) {
Review Comment:
Updated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry topic with exclusive mode. [pulsar]
Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower merged PR #23859:
URL: https://github.com/apache/pulsar/pull/23859
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry topic with exclusive mode. [pulsar]
Posted by "thetumbled (via GitHub)" <gi...@apache.org>.
thetumbled commented on PR #23859:
URL: https://github.com/apache/pulsar/pull/23859#issuecomment-2893559532
> Maybe there is a breaking change:
>
> 1. There are two consumers for a subscription
> 2. Use key_share to subscribe topic, and key_share will also subscribe retry-topic
> 3. Rolling upgrade to 3.3.5
> 4. The first consumer will fail to start because it attempts to subscribe to the retry topic using the "shared" subscription type.
>
> ```
> "errorMsg":"Subscription is of different type. Active subscription type of 'Key_Shared' is different than the connecting consumer's type 'Shared'.",
> ```
Maybe a complete stop and start process can avoid the problem?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry topic with exclusive mode. [pulsar]
Posted by "shibd (via GitHub)" <gi...@apache.org>.
shibd commented on PR #23859:
URL: https://github.com/apache/pulsar/pull/23859#issuecomment-2891170939
May be there is a break change:
1. There are 2 consumers.
2. Use key_share to subscribe topic, and key_share will also subscribe retry-topic
3. Rolling upgrade to 3.3.5
4. The first consumer will fail to start because it attempts to subscribe to the retry topic using the "shared" subscription type.
```
"errorMsg":"Subscription is of different type. Active subscription type of 'Key_Shared' is different than the connecting consumer's type 'Shared'.",
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][client] fix retry topic with exclusive mode. [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #23859:
URL: https://github.com/apache/pulsar/pull/23859#issuecomment-2893630524
> > Maybe there is a breaking change:
> >
> > 1. There are two consumers for a subscription
> > 2. Use key_share to subscribe topic, and key_share will also subscribe retry-topic
> > 3. Rolling upgrade to 3.3.5
> > 4. The first consumer will fail to start because it attempts to subscribe to the retry topic using the "shared" subscription type.
> >
> > ```
> > "errorMsg":"Subscription is of different type. Active subscription type of 'Key_Shared' is different than the connecting consumer's type 'Shared'.",
> > ```
>
> Maybe a complete stop and start process can avoid the problem?
This isn't a broker-side problem. The problem is caused by clients connecting to the broker. This is a challenging problem to address since mixed client versions cause the issue. I don't really see a way around it other than to keep the fix. The decision to upgrade the client version can be controlled and coordinated by users. There should be better release notes in Pulsar where such breaking changes are highlighted and where there would be instructions on how to deal with them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org