[fix][broker] Recover bucket delayed delivery tracker asynchronously to avoid blocking dispatcher threads#26105
Open
void-ptr974 wants to merge 1 commit into
Open
Conversation
…to avoid blocking dispatcher threads
a8e8932 to
b497567
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #26103
Motivation
BucketDelayedDeliveryTrackeris lazily created from the broker dispatch pathwhen the first delayed message needs a delayed delivery tracker.
For the bucket implementation, tracker creation also recovers delayed bucket
snapshots. This recovery can depend on metadata or storage operations, but it was
previously waited for synchronously during tracker creation.
As a result, a dispatcher thread could be blocked while holding the dispatcher
lock. If bucket snapshot recovery is slow, dispatch for the current subscription
is stalled, and other tasks queued on the same broker-topic worker can also be
delayed.
Modifications
DelayedDeliveryTrackerFactory.tracker into the dispatcher.
dispatch until the tracker is ready.
delivery time has already elapsed.
or times out.
trackers that complete after they are no longer needed.
failure, fallback, and stale tracker cleanup.
close/clear/replay behavior, and a broker-path delayed message scenario using
the real bucket tracker.
Verifying this change
This change added tests and can be verified as follows:
./gradlew :pulsar-broker:test --tests org.apache.pulsar.broker.delayed.DelayedDeliveryTrackerFactoryTest./gradlew :pulsar-broker:checkstyleMain :pulsar-broker:checkstyleTestgit diff --checkDoes this pull request potentially affect one of the following parts:
This changes delayed delivery tracker creation from synchronous recovery on the
dispatcher path to asynchronous recovery with dispatcher-side pending state and
replay handling.