-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[improve][broker]Improve PersistentMessageExpiryMonitor expire speed when ledger not existed #17842
Merged
Conversation
This file contains 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
…rableLedgerException
AnonHxy
changed the title
[improve][broker]Improve PersistentMessageExpiryMonitor expire speed if meet NonRecove…
[improve][broker]Improve PersistentMessageExpiryMonitor expire speed when ledger not existed
Sep 26, 2022
Jason918
reviewed
Sep 27, 2022
...rc/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java
Outdated
Show resolved
Hide resolved
AnonHxy
force-pushed
the
opt_expire_markdelete
branch
from
September 27, 2022 08:38
83b4680
to
36ee4d7
Compare
lordcheng10
approved these changes
Sep 28, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
AnonHxy
force-pushed
the
opt_expire_markdelete
branch
from
September 29, 2022 06:31
3b98253
to
f074db0
Compare
Jason918
approved these changes
Sep 30, 2022
/pulsarbot run-failure-checks |
AnonHxy
added
the
type/enhancement
The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
label
Oct 3, 2022
nicoloboschi
pushed a commit
to datastax/pulsar
that referenced
this pull request
Jan 10, 2023
…when ledger not existed (apache#17842) (cherry picked from commit af11c32) (cherry picked from commit fcc98d1)
nicoloboschi
pushed a commit
to datastax/pulsar
that referenced
this pull request
Jan 11, 2023
…when ledger not existed (apache#17842) (cherry picked from commit af11c32) (cherry picked from commit fcc98d1)
Technoboy-
pushed a commit
that referenced
this pull request
Feb 8, 2023
…when ledger not existed (#17842)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-picked/branch-2.9
Archived: 2.9 is end of life
cherry-picked/branch-2.10
cherry-picked/branch-2.11
doc-not-needed
Your PR changes do not impact docs
release/2.9.4
release/2.10.3
release/2.11.1
type/enhancement
The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
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
Speed up the process of
PersistentMessageExpiryMonitor
expiring message when ledgers not exist.For details:
Without consumer acking messages, the
PersistentMessageExpiryMonitor
expires messages process could be very slow if the ledgerPersistentMessageExpiryMonitor
be read has been deleted from the bookkeeper.The root cause is that, when
autoSkipNonRecoverableData
is true and the ledger to be read has been deleted, theexpireMessages
will read entry failed and set the markDeletePosition as the failed position, see Line194. And then waiting to be scheduled(defalut value is 5min)pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java
Lines 186 to 196 in 49eaa54
In the next scheduled, the
PersistentMessageExpiryMonitor
will read the next position of markDeletePosition , which is also not existed because they may belong to the same ledger.So the markDeletePosition just go forward 1 every 5min. And if there are many deleted ledgers, it will lead to the ttl expire lose efficacy
Modifications
If read entry failed with ledger not existed exceptions, we will set the markDeletePosition as the last position of the deleted ledger.
Verifying this change
org.apache.pulsar.broker.service.PersistentMessageFinderTest#testMessageExpiryWithTimestampNonRecoverableException
has coverd this changeDoes this pull request potentially affect one of the following parts:
Documentation
doc-not-needed
(Please explain why)
Matching PR in forked repository
PR in forked repository: AnonHxy#4