Repository navigation
[improve][broker] Skip unused replicated subscription timestamp updates - #26655
Merged
Merged
Conversation
lhotari
added this pull request to stack #26656
September 19, 2026 12:50
dao-jun
approved these changes
Sep 19, 2026
merlimat
approved these changes
Sep 19, 2026
lhotari
force-pushed
the
lh-improve-repl-timestamp
branch
from
September 19, 2026 18:10
d4804f6 to
47eb231
Compare
lhotari
force-pushed
the
lh-improve-repl-timestamp
branch
from
September 19, 2026 19:41
47eb231 to
2beeeb9
Compare
Assisted-by: Codex
Only seed snapshot activity when the managed ledger contains entries. Preserve the post-construction check for publishes racing with controller activation, and cover both paths in the lifecycle test. Assisted-by: Codex
lhotari
force-pushed
the
lh-improve-repl-timestamp
branch
from
September 19, 2026 21:16
90b1c58 to
04ed5eb
Compare
2 of 11 tasks
ascentstream-bot
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Oct 1, 2026
…es (apache#26655) (cherry picked from commit 3947c95)
ascentstream-bot
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Oct 2, 2026
…es (apache#26655) (cherry picked from commit 3947c95)
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.
Motivation
Every successful normal publish advances the transaction buffer's maximum readable position. That path currently reads the wall clock and writes
lastMaxReadPositionMovedForwardTimestamp, even when replicated subscriptions are not enabled for the topic.ReplicatedSubscriptionsControlleris the only production consumer of this timestamp. On ordinary topics, the clock read and volatile write therefore add work to every publish without affecting broker behavior.Modifications
Performance
An actual-callback JMH benchmark measured the controller-absent path:
Allocation remains effectively zero. When a replicated-subscription controller is active, the added presence check measured 20.090 ns/op versus 19.360 ns/op for the unconditional baseline (+0.730 ns/op).
A five-million-message broker scenario with 500 producers and five Key_Shared subscriptions produced two positive matched comparisons:
The spread indicates substantial whole-host variance, so these runs establish repeatability and absence of a throughput regression rather than a precise effect size. Every run delivered all messages to every subscription with zero duplicates, ordering violations, or invalid messages.
Verifying this change
This change added tests and can be verified as follows:
ReplicatedSubscriptionTest.testReplicationSnapshotStopWhenNoTrafficand the empty-topic lifecycle regression on the original code.ReplicatedSubscriptionTestandReplicatedSubscriptionsControllerTestpassed with-PtestRetryCount=0../gradlew :microbench:shadowJar quickCheckDoes this pull request potentially affect one of the following parts: