gaoran10 commented on a change in pull request #14656:
URL: https://github.com/apache/pulsar/pull/14656#discussion_r824465520
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -1051,10 +1051,12 @@ public void deleteCursorFailed(ManagedLedgerException
exception, Object ctx) {
void removeSubscription(String subscriptionName) {
PersistentSubscription sub = subscriptions.remove(subscriptionName);
- // preserve accumulative stats form removed subscription
- SubscriptionStatsImpl stats = sub.getStats(false, false, false);
- bytesOutFromRemovedSubscriptions.add(stats.bytesOutCounter);
- msgOutFromRemovedSubscriptions.add(stats.msgOutCounter);
+ if (sub != null) {
Review comment:
Maybe we could record the null sub by a warning log.
like this, just a demo code
```
if (sub == null) {
log.warn("The subscription {} for topic {} is not existing.",
subscriptionName, topic).
return;
}
```
--
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]