michaeljmarshall commented on a change in pull request #10644:
URL: https://github.com/apache/pulsar/pull/10644#discussion_r635650389



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -976,7 +980,11 @@ public void deleteCursorFailed(ManagedLedgerException 
exception, Object ctx) {
     }
 
     void removeSubscription(String subscriptionName) {
-        subscriptions.remove(subscriptionName);
+        PersistentSubscription sub = subscriptions.remove(subscriptionName);
+        // preserve accumulative stats form removed subscription
+        SubscriptionStats stats = sub.getStats(false, false);

Review comment:
       Do you think it'd be worth adding specific getters for the two counters 
we want here? I am specifically concerned about the overhead of building out 
the whole `SubscriptionStats` object many times. I'm not sure _how_ expensive 
the `getStats` method really is, though.




-- 
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.

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


Reply via email to