[fix][broker] Read subscription properties directly from cursor#26159
Merged
nodece merged 2 commits intoJul 9, 2026
Conversation
lhotari
approved these changes
Jul 8, 2026
dao-jun
approved these changes
Jul 9, 2026
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
PersistentSubscription.subscriptionPropertiesstores a cached snapshot initialized on construction, and can only be refreshed viaupdateSubscriptionProperties.Other components write properties directly using
ManagedCursor.putCursorProperty, especially the#pulsar.internal.delayed.bucket_*keys generated by the delayed message bucket tracker, but these changes will not sync to the local cache.This leads to stale data returned by:
org.apache.pulsar.client.admin.Topics#getSubscriptionPropertiesorg.apache.pulsar.client.admin.Topics#getStats(java.lang.String, org.apache.pulsar.client.admin.GetStatsOptions)The cache can only reload the latest data from
cursor.getCursorProperties()after broker restart.Modifications
subscriptionPropertiesfield, use cursor as the single source of truth for properties.getSubscriptionProperties()to directly returncursor.getCursorProperties(), so admin interfaces andPersistentSubscription.getStatsAsynccan read real-time data.updateSubscriptionPropertiesto one singlecursor.setCursorProperties(...)call, no extra cache field synchronization required.subscriptionPropertiesparameter. This unused parameter will be deleted in a subsequent PR after cleaning all relevant callsites inPersistentTopic.PersistentSubscriptionTest#testGetSubscriptionPropertiesReflectsLiveCursorUpdatesto verify real-time property visibility for bothgetSubscriptionProperties()and stats logic.