dao-jun commented on code in PR #23918:
URL: https://github.com/apache/pulsar/pull/23918#discussion_r1938517234


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/InMemoryDelayedDeliveryTracker.java:
##########
@@ -218,9 +218,26 @@ public NavigableSet<Position> getScheduledMessages(int 
maxMessages) {
         return positions;
     }
 
+    public boolean shouldSkipMessage(long ledgerId, long entryId) {
+        for (Long2ObjectMap<Roaring64Bitmap> ledgerMap : 
delayedMessageMap.values()) {
+            Roaring64Bitmap entryIds = ledgerMap.get(ledgerId);
+            if (entryIds != null && entryIds.contains(entryId)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     @Override
     public CompletableFuture<Void> clear() {
-        this.delayedMessageMap.clear();
+        long cutoffTime = getCutoffTime();

Review Comment:
   why only clear expired index?



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/InMemoryDelayedDeliveryTracker.java:
##########
@@ -218,9 +218,26 @@ public NavigableSet<Position> getScheduledMessages(int 
maxMessages) {
         return positions;
     }
 
+    public boolean shouldSkipMessage(long ledgerId, long entryId) {

Review Comment:
   it better to keep the method name with `BucketDelayedDeliveryTracker`, 
change `shouldSkipMessage `  to `contains`.



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