lhotari commented on code in PR #24430:
URL: https://github.com/apache/pulsar/pull/24430#discussion_r2158670099


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/InMemoryDelayedDeliveryTracker.java:
##########
@@ -125,6 +130,8 @@ public boolean addMessage(long ledgerId, long entryId, long 
deliverAt) {
         delayedMessageMap.computeIfAbsent(timestamp, k -> new 
Long2ObjectRBTreeMap<>())
                 .computeIfAbsent(ledgerId, k -> new Roaring64Bitmap())
                 .add(entryId);
+        delayedMessagesCount.incrementAndGet();

Review Comment:
   I guess it is designed in a way where it shouldn't be possible to be added 
multiple time.
   
   there is code to call the clear method of the InMemoryDelayedDeliveryTracker:
   
https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java#L186-L201
   
   However, it's hard to see if all possible code execution paths are covered. 
In dispatcher code, `cursor.rewind()` is called in multiple locations. For 
example:
   
   
https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java#L833
   
   It does look like `.clear()` would be called either before or after 
`.rewind()`.



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