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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/InMemoryDelayedDeliveryTracker.java:
##########
@@ -122,21 +122,29 @@ private static long trimLowerBit(long timestamp, int 
bits) {
     }
 
     @Override
-    public boolean addMessage(long ledgerId, long entryId, long deliverAt) {
+    public synchronized boolean addMessage(long ledgerId, long entryId, long 
deliverAt) {

Review Comment:
   I looked again and I didn't find execution paths which would by pass the 
synchronized locks of the dispatcher (included in this PR). Have you checked if 
the bugs reproduce if these methods aren't synchronized? If that's the case, it 
we could remove the `synchronized` handling from this PR and create a separate 
PR to prevent future regressions with the `AbstractDelayedDeliveryTracker` 
refactoring.
   
   btw. Comment about the existing code (not this PR): One detail that annoys 
me is the separate handling for `BucketDelayedDeliveryTracker` implementation 
in the dispatcher. It's not great design. The `DelayedDeliveryTracker` 
interface should have been extended to cover the additional integration methods 
instead of coupling directly to the implementation which is the whole point of 
using an interface (which is in place to allow third-part implementations by 
configuring `dispatchRateLimiterFactoryClassName`)



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