Repository navigation
[fix][broker] Preserve replicated subscription activity on activation - #26780
Merged
lhotari merged 1 commit intoOct 1, 2026
Merged
Conversation
ascentstream-bot
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Oct 1, 2026
…apache#26780) (cherry picked from commit 1f22326)
ascentstream-bot
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Oct 2, 2026
…apache#26780) (cherry picked from commit 1f22326)
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
After #26655, messages published while the replicated subscriptions controller is inactive no longer update the snapshot activity timestamp. If those messages are consumed and their ledgers are trimmed before subscription replication is enabled, both activation seed checks see zero retained entries, leaving snapshots paused until another message is published.
The controller also schedules its first snapshot before initializing its statistics object, allowing the zero-delay task to encounter a null
statsreference and leave the pending snapshot gauge incremented.Modifications
Verifying this change
This change added tests and can be verified as follows:
ReplicatedSubscriptionTest: publish, consume, acknowledge and trim data through the real broker/client path, then enable subscription replication and verify that a cross-cluster snapshot completes without another publish. Covers initial activation, reactivation and keeping empty topics idle.ReplicatedSubscriptionConfigTest: execute the first scheduler tick during controller construction using a real topic, marker publication and statistics object.TopicTransactionBufferRecoveryTest: publish while the real snapshot processor is paused, then verify that recovery advances the snapshot activity timestamp. Covers recovery with and without a persisted snapshot.Both bug-fix regressions failed before their corresponding fixes. Local validation passed 22 tests and
quickCheck:Does this pull request potentially affect one of the following parts:
Initializing statistics before scheduling prevents the first snapshot task from failing after incrementing the pending snapshot gauge. Metric names and definitions are unchanged.