coderzc commented on code in PR #20075:
URL: https://github.com/apache/pulsar/pull/20075#discussion_r1164368805


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -1101,9 +1101,13 @@ public CompletableFuture<Void> clearDelayedMessages() {
         if (delayedDeliveryTracker.isEmpty() && topic.getBrokerService()
                 .getDelayedDeliveryTrackerFactory() instanceof 
BucketDelayedDeliveryTrackerFactory) {
             synchronized (this) {
-                if (delayedDeliveryTracker.isEmpty()) {
-                    delayedDeliveryTracker = Optional
-                            
.of(topic.getBrokerService().getDelayedDeliveryTrackerFactory().newTracker(this));
+                try {
+                    if (delayedDeliveryTracker.isEmpty()) {
+                        delayedDeliveryTracker = Optional
+                                
.of(topic.getBrokerService().getDelayedDeliveryTrackerFactory().newTracker(this));

Review Comment:
   @poorbarcode Because the dispatcher was closed before `unsubscribe` was 
called,  this lead to the tracker reference being lost, so we need to 
reinitialize the tracker to clean up residual persistent data.
   
   Please see: line-1320、line-1352
   
https://github.com/apache/pulsar/blob/4f503fd886cd25670b6344defb8feb1ff2a6e816/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java#L1320-L1357



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