singhvishalkr opened a new pull request, #1128: URL: https://github.com/apache/pulsar-site/pull/1128
## Motivation Closes apache/pulsar#23701. Users looking at topic stats get confused when the topic's `msgOutCounter` (and `bytesOutCounter`) is larger than the sum across the `subscriptions` map: > the topic's `msgOutCounter` is 50000 but the sum of all subscriptions' `msgOutCounter` is only 20000 (…) would be confusing to users. That's not a bug, it's by design. Reading [`PersistentTopic.removeSubscription`](https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java#L1495-L1511) and the topic-stats aggregation loop: - When a subscription is removed (durable-unsubscribe or a non-durable reader closing), its accumulated `msgOutCounter` / `bytesOutCounter` is preserved into `msgOutFromRemovedSubscriptions` / `bytesOutFromRemovedSubscriptions`. - The topic-level counter is seeded with those "removed" totals and then adds the counters of currently-attached subscriptions ([see the aggregation](https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java#L2967-L3085)). - The `subscriptions` map in the stats payload only lists subscriptions that are currently attached, so closed readers and unsubscribed durable subs drop out of the per-subscription view while still contributing to the topic total. So the topic-level counter is a monotonic grand total and can legitimately exceed `sum(subscriptions[*].{msg,bytes}OutCounter)`. ## Modifications - `docs/administration-stats.md`: expand the `bytesOutCounter` / `msgOutCounter` rows in the topic-level **Stats** table to call out the monotonic-counter semantics and the non-durable / removed-subscription case. - `versioned_docs/version-4.2.x/administration-stats.md`: mirror the same text into the current LTS-versioned copy. Pure docs. No generated assets, no link changes outside the table. ## Verifying this change - [x] Make sure that the change passes the `ci-*` tests. ## Documentation - [x] `doc-required` (Your PR contains features that require documentation, such as new features or bug fixes.) - [ ] `doc-not-needed` - [ ] `doc` - [ ] `doc-complete` ## Matching PR in forked repository PR in forked repository: https://github.com/singhvishalkr/pulsar-site/pull/new/docs-23701-topic-out-counter-semantics -- 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]
