lhotari opened a new pull request, #19394:
URL: https://github.com/apache/pulsar/pull/19394

   ### Motivation
   
   - RangeMap isn't thread safe and should be mutated under the object monitor 
lock of BucketDelayedDeliveryTracker. Mutating in CompletableFuture callback 
results in completion of another thread without the lock.
   - In Java, it doesn't make sense to use a random object monitor such as 
`synchronized (this.snapshotSegmentLastIndexTable) {` or `synchronized 
(this.sharedBucketPriorityQueue) {`. All accesses, both reads and writes should 
happen under the same object monitor. 
   
   ### Additional details
   
   - Possible failures were ignored in the previous code since the removal was 
executed in `whenComplete` that ignored errors. @coderzc Was this intentional?
   
   ### Modifications
   
   - refactor logic in BucketDelayedDeliveryTracker#recoverBucketSnapshot so 
that asynchronous calls are first waited
     to complete and the data structures are updated in the calling thread that 
is already in the `synchronized` block.
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->


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