nodece opened a new pull request, #26159:
URL: https://github.com/apache/pulsar/pull/26159

   ### Motivation
   
   `PersistentSubscription.subscriptionProperties` is a cached snapshot taken at
   construction (or refreshed only via `updateSubscriptionProperties`). 
Properties
   that other components write directly through 
`ManagedCursor.putCursorProperty` --
   notably the `#pulsar.internal.delayed.bucket_*` keys produced by the bucket
   delayed delivery tracker -- never update the cache. As a result
   `getSubscriptionProperties()`, `topics stats` and the
   `GET /subscription/properties` admin endpoint report a stale view until the
   broker restarts and reseeds the cache from `cursor.getCursorProperties()`.
   
   Concretely, after producing enough delayed messages to trigger a bucket
   snapshot seal, operators see no bucket keys in `bin/pulsar-admin topics 
stats`
   until they restart the broker.
   
   ### Modifications
   
   * Drop the cached `subscriptionProperties` field; treat the cursor as the
     single source of truth.
   * `getSubscriptionProperties()` now returns `cursor.getCursorProperties()`
     directly, so admin endpoints and `PersistentSubscription.getStatsAsync` see
     the live state.
   * Simplify `updateSubscriptionProperties` to a single
     `cursor.setCursorProperties(...)` call -- there is no field to keep in 
sync.
   * Deprecate the constructor overload that takes a `subscriptionProperties`
     parameter; the parameter is no longer used and will be removed once call
     sites in `PersistentTopic` are cleaned up in a follow-up.
   * Add 
`PersistentSubscriptionTest#testGetSubscriptionPropertiesReflectsLiveCursorUpdates`
     covering both `getSubscriptionProperties()` and the `getStatsAsync` path.
   * Add `BucketSnapshotVisibilityTest#testBucketKeysVisibleAfterSeal` covering
     the end-to-end bucket delayed delivery scenario.
   
   ### Verifying
   
   Verify bucket snapshot keys are exposed via `bin/pulsar-admin topics stats`
   without restarting the broker:
   
   ```bash
   # produce enough delayed messages so the bucket tracker seals a snapshot
   bin/pulsar-perf produce <topic> -m 50000 -s 1 --rate 50000 -db -d 60
   
   # stats should now list subscriptionProperties like
   # "#pulsar.internal.delayed.bucket_<l>_<l>": "<bucketId>"
   bin/pulsar-admin topics stats <topic>
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to