You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "hangc0276 (via GitHub)" <gi...@apache.org> on 2024/04/29 15:29:36 UTC
[PR] [improve] [broker] Add subscription ignore list for ttl check [pulsar]
hangc0276 opened a new pull request, #22614:
URL: https://github.com/apache/pulsar/pull/22614
<!--
### Contribution Checklist
- PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://pulsar.apache.org/contribute/develop-semantic-title/)*.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Each pull request should address only one issue, not mix up code from multiple issues.
- Each commit in the pull request has a meaningful commit message
- Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
-->
<!-- Either this PR fixes an issue, -->
Fixes #xyz
<!-- or this PR is one task of an issue -->
Main Issue: #xyz
<!-- If the PR belongs to a PIP, please add the PIP link here -->
PIP: #xyz
<!-- Details of when a PIP is required and how the PIP process work, please see: https://github.com/apache/pulsar/blob/master/pip/README.md -->
### Motivation
<!-- Explain here the context, and why you're making that change. What is the problem you're trying to solve. -->
Message TTL will move the cursors based on the configured `ttlDurationDefaultInSeconds`. However, for those system topics' cursors, such as compaction service cursor, transaction system topic cursor, and even some third-party plugins cursors, should not or don't want to be impacted by the TTL.
We have one PR https://github.com/apache/pulsar/pull/21865 to filter the compaction service cursors for TTL check, but doesn't cover other system topics cursors. To provide a general solution and support third-party plugin cursors not impacted by TTL, I proposed to add a subscription ignore list `SubscriptionsIgnoredByTtl` to filter the TTL check.
### Modifications
Add a configuration in `conf/broker.conf` to support filter subscriptions for TTL check.
<!-- Describe the modifications you've done. -->
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
*(Please pick either of the following options)*
This change is a trivial rework / code cleanup without any test coverage.
*(or)*
This change is already covered by existing tests, such as *(please describe tests)*.
*(or)*
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 -->
- [x] `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: <!-- ENTER URL HERE -->
<!--
After opening this PR, the build in apache/pulsar will fail and instructions will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since the
apache/pulsar CI based on GitHub Actions has constrained resources and quota.
GitHub Actions provides separate quota for pull requests that are executed in
a forked repository.
The tests will be run in the forked repository until all PR review comments have
been handled, the tests pass and the PR is approved by a reviewer.
-->
--
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] [improve] [broker] Add systemCursorNames ignore list for ttl check [pulsar]
Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on code in PR #22614:
URL: https://github.com/apache/pulsar/pull/22614#discussion_r1590013110
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java:
##########
@@ -652,6 +652,12 @@ The max allowed delay for delayed delivery (in milliseconds). If the broker rece
)
private int ttlDurationDefaultInSeconds = 0;
+ @FieldContext(
+ category = CATEGORY_POLICIES,
+ doc = "System subscriptions that will be ignored by ttl check. Default is empty."
Review Comment:
I keep the default value empty and add the changes in `broker.conf` and `standalone.conf`
--
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] [improve] [broker] Add systemCursorNames ignore list for ttl check [pulsar]
Posted by "horizonzy (via GitHub)" <gi...@apache.org>.
horizonzy commented on code in PR #22614:
URL: https://github.com/apache/pulsar/pull/22614#discussion_r1590507791
##########
conf/standalone.conf:
##########
@@ -121,6 +121,9 @@ backlogQuotaDefaultLimitSecond=-1
# Default ttl for namespaces if ttl is not already configured at namespace policies. (disable default-ttl with value 0)
ttlDurationDefaultInSeconds=0
+# Additional system subscriptions that will be ignored by ttl check. Default is empty.
Review Comment:
We can add comments for `comma separated` here.
--
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] [improve] [broker] Add subscription ignore list for ttl check [pulsar]
Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui commented on PR #22614:
URL: https://github.com/apache/pulsar/pull/22614#issuecomment-2084674118
@hangc0276 Maybe we'd better introduce a system subscription concept to avoid the TTL, backlog quota policy(consumer eviction) applied to the system subscription.
For example:
```
systemCursorNames=__compaction,__dedup
```
--
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] [improve] [broker] Add additionalSystemCursorNames ignore list for TTL check [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- merged PR #22614:
URL: https://github.com/apache/pulsar/pull/22614
--
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] [improve] [broker] Add systemCursorNames ignore list for ttl check [pulsar]
Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on PR #22614:
URL: https://github.com/apache/pulsar/pull/22614#issuecomment-2084983052
> @hangc0276 Maybe we'd better introduce a system subscription concept to avoid the TTL, backlog quota policy(consumer eviction) applied to the system subscription.
>
> For example:
>
> ```
> systemCursorNames=__compaction,__dedup
> ```
@codelipenghui Make sense. Updated the code.
--
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] [improve] [broker] Add additionalSystemCursorNames ignore list for TTL check [pulsar]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #22614:
URL: https://github.com/apache/pulsar/pull/22614#issuecomment-2102540599
## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/22614?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `80.00000%` with `1 lines` in your changes are missing coverage. Please review.
> Project coverage is 73.11%. 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 [(`2a02e0f`)](https://app.codecov.io/gh/apache/pulsar/pull/22614?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 250 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/pulsar/pull/22614?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #22614 +/- ##
============================================
- Coverage 73.57% 73.11% -0.46%
+ Complexity 32624 32467 -157
============================================
Files 1877 1888 +11
Lines 139502 141113 +1611
Branches 15299 15487 +188
============================================
+ Hits 102638 103179 +541
- Misses 28908 29962 +1054
- Partials 7956 7972 +16
```
| [Flag](https://app.codecov.io/gh/apache/pulsar/pull/22614/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/22614/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `27.38% <40.00%> (+2.80%)` | :arrow_up: |
| [systests](https://app.codecov.io/gh/apache/pulsar/pull/22614/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `24.66% <40.00%> (+0.34%)` | :arrow_up: |
| [unittests](https://app.codecov.io/gh/apache/pulsar/pull/22614/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `72.13% <80.00%> (-0.72%)` | :arrow_down: |
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](https://app.codecov.io/gh/apache/pulsar/pull/22614?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...org/apache/pulsar/broker/ServiceConfiguration.java](https://app.codecov.io/gh/apache/pulsar/pull/22614?src=pr&el=tree&filepath=pulsar-broker-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fbroker%2FServiceConfiguration.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3B1bHNhci9icm9rZXIvU2VydmljZUNvbmZpZ3VyYXRpb24uamF2YQ==) | `99.40% <100.00%> (+<0.01%)` | :arrow_up: |
| [...sar/broker/service/persistent/PersistentTopic.java](https://app.codecov.io/gh/apache/pulsar/pull/22614?src=pr&el=tree&filepath=pulsar-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fbroker%2Fservice%2Fpersistent%2FPersistentTopic.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL3BlcnNpc3RlbnQvUGVyc2lzdGVudFRvcGljLmphdmE=) | `79.24% <66.66%> (+0.79%)` | :arrow_up: |
... and [355 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/22614/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] [improve] [broker] Add systemCursorNames ignore list for ttl check [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #22614:
URL: https://github.com/apache/pulsar/pull/22614#discussion_r1589662256
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java:
##########
@@ -652,6 +652,12 @@ The max allowed delay for delayed delivery (in milliseconds). If the broker rece
)
private int ttlDurationDefaultInSeconds = 0;
+ @FieldContext(
+ category = CATEGORY_POLICIES,
+ doc = "System subscriptions that will be ignored by ttl check. Default is empty."
Review Comment:
"Default is empty" in the description, but there's `__compaction` in the default.
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java:
##########
@@ -652,6 +652,12 @@ The max allowed delay for delayed delivery (in milliseconds). If the broker rece
)
private int ttlDurationDefaultInSeconds = 0;
+ @FieldContext(
+ category = CATEGORY_POLICIES,
+ doc = "System subscriptions that will be ignored by ttl check. Default is empty."
Review Comment:
Please also add changes to the default `broker.conf` and `standalone.conf` files if this is something that should be usually configurable by users.
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1933,7 +1936,7 @@ public void checkMessageExpiry() {
int messageTtlInSeconds = topicPolicies.getMessageTTLInSeconds().get();
if (messageTtlInSeconds != 0) {
subscriptions.forEach((__, sub) -> {
- if (!isCompactionSubscription(sub.getName())) {
+ if (systemCursorNames.contains(sub.getName())) {
Review Comment:
I think it would be better to always ignore the compaction subscription. It could be better to change the meaning of the configurable `systemCursorNames` to be additional system cursor names.
--
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] [improve] [broker] Add systemCursorNames ignore list for ttl check [pulsar]
Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on PR #22614:
URL: https://github.com/apache/pulsar/pull/22614#issuecomment-2094286725
> I added a review with some details to address.
>
> I think we have a principle to create PIPs when we add new features to Pulsar. The PIP document could be a "1 pager" and minimal. Do you have a plan to document this change as a PIP document?
@lhotari Thanks for your review. I created a PIP for this change. Please help take a look, thanks. https://github.com/apache/pulsar/pull/22651
--
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] [improve] [broker] Add systemCursorNames ignore list for ttl check [pulsar]
Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on code in PR #22614:
URL: https://github.com/apache/pulsar/pull/22614#discussion_r1590013045
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1933,7 +1936,7 @@ public void checkMessageExpiry() {
int messageTtlInSeconds = topicPolicies.getMessageTTLInSeconds().get();
if (messageTtlInSeconds != 0) {
subscriptions.forEach((__, sub) -> {
- if (!isCompactionSubscription(sub.getName())) {
+ if (systemCursorNames.contains(sub.getName())) {
Review Comment:
make sense. 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