-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improve][broker]Find the target position at most once, during expiring messages for a topic, even though there are many subscriptions #24622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Outdated
Show resolved
Hide resolved
...ker/src/test/java/org/apache/bookkeeper/mledger/impl/PersistentMessageExpiryMonitorTest.java
Show resolved
Hide resolved
...ker/src/test/java/org/apache/bookkeeper/mledger/impl/PersistentMessageExpiryMonitorTest.java
Show resolved
Hide resolved
coderzc
reviewed
Aug 13, 2025
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Show resolved
Hide resolved
codelipenghui
approved these changes
Aug 13, 2025
coderzc
approved these changes
Aug 13, 2025
Contributor
Author
|
/pulsarbot rerun-failure-checks |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #24622 +/- ##
============================================
- Coverage 74.38% 74.26% -0.12%
- Complexity 32808 32848 +40
============================================
Files 1881 1885 +4
Lines 146843 147007 +164
Branches 16866 16936 +70
============================================
- Hits 109222 109169 -53
- Misses 28964 29131 +167
- Partials 8657 8707 +50
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
manas-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Aug 28, 2025
…ng messages for a topic, even though there are many subscriptions (apache#24622) (cherry picked from commit 84205eb) (cherry picked from commit 29778d5)
4 tasks
Technoboy-
pushed a commit
to Technoboy-/pulsar
that referenced
this pull request
Sep 10, 2025
…ng messages for a topic, even though there are many subscriptions (apache#24622) (cherry picked from commit 84205eb)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Sep 12, 2025
…ng messages for a topic, even though there are many subscriptions (apache#24622) (cherry picked from commit 84205eb) (cherry picked from commit 29778d5)
nborisov
pushed a commit
to nborisov/pulsar
that referenced
this pull request
Sep 12, 2025
…ng messages for a topic, even though there are many subscriptions (apache#24622) (cherry picked from commit 84205eb)
KannarFr
pushed a commit
to CleverCloud/pulsar
that referenced
this pull request
Sep 22, 2025
…ng messages for a topic, even though there are many subscriptions (apache#24622)
walkinggo
pushed a commit
to walkinggo/pulsar
that referenced
this pull request
Oct 8, 2025
…ng messages for a topic, even though there are many subscriptions (apache#24622)
4 tasks
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-picked/branch-4.0
doc-not-needed
Your PR changes do not impact docs
ready-to-test
release/4.0.7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
1. Instead of finding the target position for each subscription, search the target position once, and expire messages for each subscription.
Background: The steps of expiry of a topic
So the task calls for finding the target position many times when a topic expires. But the finding position operation is really expensive
2. Improve the method
expireMessages(Position)The previous steps of expiring messages by position:
It costs a lot, we can simplify the steps by
managedLedger.getPreviousPosition(x)Modifications
Since all of the tasks that find the target position that relates to the same topic will get the same result, we can call the finding operation at most once, during expiring messages for a topic
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: x