You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "lifepuzzlefun (via GitHub)" <gi...@apache.org> on 2023/09/16 13:20:00 UTC
[GitHub] [pulsar] lifepuzzlefun opened a new pull request, #21193: [fix][broker] Avoid record inactiveproducers when deduplication is disable.
lifepuzzlefun opened a new pull request, #21193:
URL: https://github.com/apache/pulsar/pull/21193
Fixes #21192
### Motivation
Short alive producer (create, send message, close) will create a lot record in deduplication inactiveproducers.
even there is clear logic but default interval is too long and is broker level.
### Modifications
if deduplication is disabled do not record producer in inactive producers.
### Verifying this change
This change is already covered by existing tests, such as *(please describe tests)*.
<!-- 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: <!-- 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
[GitHub] [pulsar] lifepuzzlefun commented on a diff in pull request #21193: [improve][broker] Avoid record inactiveproducers when deduplication is disable.
Posted by "lifepuzzlefun (via GitHub)" <gi...@apache.org>.
lifepuzzlefun commented on code in PR #21193:
URL: https://github.com/apache/pulsar/pull/21193#discussion_r1335385611
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java:
##########
@@ -493,6 +501,12 @@ public synchronized void purgeInactiveProducers() {
long minimumActiveTimestamp = System.currentTimeMillis() - TimeUnit.MINUTES
.toMillis(pulsar.getConfiguration().getBrokerDeduplicationProducerInactivityTimeoutMinutes());
+ // if not enabled just clear all inactive producer record.
+ if (!isEnabled()) {
Review Comment:
if we enable and disable deduplication for master code logic. the inactive producer will be delay for getBrokerDeduplicationProducerInactivityTimeoutMinutes to clean up.
Do we want to check in Topic.checkMessageDeduplicationInfo to check if deduplication is enabled if not just skip call purgeInactiveProducers ? If yes the inactive producer should be clear in disable deduplication logic.
--
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] Avoid record inactiveproducers when deduplication is disable. [pulsar]
Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #21193:
URL: https://github.com/apache/pulsar/pull/21193#discussion_r1421853816
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java:
##########
@@ -493,6 +501,12 @@ public synchronized void purgeInactiveProducers() {
long minimumActiveTimestamp = System.currentTimeMillis() - TimeUnit.MINUTES
.toMillis(pulsar.getConfiguration().getBrokerDeduplicationProducerInactivityTimeoutMinutes());
+ // if not enabled just clear all inactive producer record.
+ if (!isEnabled()) {
Review Comment:
Please add a meaningful comment here to explain the dynamic configuration update problem. btw, maybe we can move the cleanup logic into `checkStatus` logic?
--
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
[GitHub] [pulsar] mattisonchao commented on a diff in pull request #21193: [improve][broker] Avoid record inactiveproducers when deduplication is disable.
Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #21193:
URL: https://github.com/apache/pulsar/pull/21193#discussion_r1335317596
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java:
##########
@@ -493,6 +501,12 @@ public synchronized void purgeInactiveProducers() {
long minimumActiveTimestamp = System.currentTimeMillis() - TimeUnit.MINUTES
.toMillis(pulsar.getConfiguration().getBrokerDeduplicationProducerInactivityTimeoutMinutes());
+ // if not enabled just clear all inactive producer record.
+ if (!isEnabled()) {
Review Comment:
Why put the check 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
[GitHub] [pulsar] mattisonchao commented on a diff in pull request #21193: [improve][broker] Avoid record inactiveproducers when deduplication is disable.
Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #21193:
URL: https://github.com/apache/pulsar/pull/21193#discussion_r1335317596
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java:
##########
@@ -493,6 +501,12 @@ public synchronized void purgeInactiveProducers() {
long minimumActiveTimestamp = System.currentTimeMillis() - TimeUnit.MINUTES
.toMillis(pulsar.getConfiguration().getBrokerDeduplicationProducerInactivityTimeoutMinutes());
+ // if not enabled just clear all inactive producer record.
+ if (!isEnabled()) {
Review Comment:
Why put the check here? Can we move it to `checkMessageDeduplicationInfo`?
--
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
[GitHub] [pulsar] codecov-commenter commented on pull request #21193: [improve][broker] Avoid record inactiveproducers when deduplication is disable.
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #21193:
URL: https://github.com/apache/pulsar/pull/21193#issuecomment-1722499780
## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/21193?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#21193](https://app.codecov.io/gh/apache/pulsar/pull/21193?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (4ad8160) into [master](https://app.codecov.io/gh/apache/pulsar/commit/2aa8c3b1a284673b512db2b815514343ec3e7c19?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (2aa8c3b) will **increase** coverage by `36.23%`.
> Report is 3 commits behind head on master.
> The diff coverage is `100.00%`.
[](https://app.codecov.io/gh/apache/pulsar/pull/21193?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #21193 +/- ##
=============================================
+ Coverage 36.92% 73.16% +36.23%
- Complexity 12203 32458 +20255
=============================================
Files 1698 1887 +189
Lines 130400 140094 +9694
Branches 14251 15428 +1177
=============================================
+ Hits 48153 102499 +54346
+ Misses 75908 29498 -46410
- Partials 6339 8097 +1758
```
| [Flag](https://app.codecov.io/gh/apache/pulsar/pull/21193/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/21193/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `24.08% <28.57%> (-0.14%)` | :arrow_down: |
| [systests](https://app.codecov.io/gh/apache/pulsar/pull/21193/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `24.94% <28.57%> (-0.19%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pulsar/pull/21193/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `72.46% <100.00%> (+40.46%)` | :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 Changed](https://app.codecov.io/gh/apache/pulsar/pull/21193?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...roker/service/persistent/MessageDeduplication.java](https://app.codecov.io/gh/apache/pulsar/pull/21193?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL3BlcnNpc3RlbnQvTWVzc2FnZURlZHVwbGljYXRpb24uamF2YQ==) | `82.30% <100.00%> (+43.96%)` | :arrow_up: |
... and [1447 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/21193/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
--
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] Avoid record inactiveproducers when deduplication is disable. [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- commented on code in PR #21193:
URL: https://github.com/apache/pulsar/pull/21193#discussion_r1421856217
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java:
##########
@@ -493,6 +501,12 @@ public synchronized void purgeInactiveProducers() {
long minimumActiveTimestamp = System.currentTimeMillis() - TimeUnit.MINUTES
.toMillis(pulsar.getConfiguration().getBrokerDeduplicationProducerInactivityTimeoutMinutes());
+ // if not enabled just clear all inactive producer record.
+ if (!isEnabled()) {
+ inactiveProducers.clear();
Review Comment:
I think we don't need to check this. because we check `isEnabled()` when add and remove.
--
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] Avoid record inactiveproducers when deduplication is disable. [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- commented on code in PR #21193:
URL: https://github.com/apache/pulsar/pull/21193#discussion_r1421212573
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java:
##########
@@ -493,6 +501,12 @@ public synchronized void purgeInactiveProducers() {
long minimumActiveTimestamp = System.currentTimeMillis() - TimeUnit.MINUTES
.toMillis(pulsar.getConfiguration().getBrokerDeduplicationProducerInactivityTimeoutMinutes());
+ // if not enabled just clear all inactive producer record.
+ if (!isEnabled()) {
Review Comment:
Hi @lifepuzzlefun
I think we'd better remove the check here, because we add the check in `producerRemoved` and `producerAdded` .
--
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] Avoid record inactiveproducers when deduplication is disable. [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- commented on code in PR #21193:
URL: https://github.com/apache/pulsar/pull/21193#discussion_r1421856217
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java:
##########
@@ -493,6 +501,12 @@ public synchronized void purgeInactiveProducers() {
long minimumActiveTimestamp = System.currentTimeMillis() - TimeUnit.MINUTES
.toMillis(pulsar.getConfiguration().getBrokerDeduplicationProducerInactivityTimeoutMinutes());
+ // if not enabled just clear all inactive producer record.
+ if (!isEnabled()) {
+ inactiveProducers.clear();
Review Comment:
I think we don't need to check this. because we check `isEnabled()` when add and remove.
--
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] Avoid record inactiveproducers when deduplication is disable. [pulsar]
Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao commented on code in PR #21193:
URL: https://github.com/apache/pulsar/pull/21193#discussion_r1421852857
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java:
##########
@@ -493,6 +501,12 @@ public synchronized void purgeInactiveProducers() {
long minimumActiveTimestamp = System.currentTimeMillis() - TimeUnit.MINUTES
.toMillis(pulsar.getConfiguration().getBrokerDeduplicationProducerInactivityTimeoutMinutes());
+ // if not enabled just clear all inactive producer record.
+ if (!isEnabled()) {
+ inactiveProducers.clear();
Review Comment:
```
if(!inactiveProducers.isEmpty()) {
inactiveProducers.clear();
}
```
--
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] Avoid record inactiveproducers when deduplication is disable. [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- merged PR #21193:
URL: https://github.com/apache/pulsar/pull/21193
--
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