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

   ### Motivation
   
   If more the one task named `expireMessage` were executed at the same time, 
the mechanism `expirationCheckInProgress` prevents them from executing 
concurrently, but it is not well enough.
   
   | `task: expire msg 1` | `task: expire msg 2` |
   | --- | --- |
   | `expirationCheckInProgress` -> `true`<sup>[1]</sup> | 
   | find target position<sup>[2]</sup> | 
   | start to reset cursor<sup>[3]</sup> |
   | `expirationCheckInProgress` -> `false`sup>[3]</sup> |
   | | `expirationCheckInProgress` -> `true`<sup>[1]</sup> | 
   | | find target position<sup>[2]</sup> | 
   | | start to reset cursor<sup>[3]</sup> |
   | | get an error: `cursor reset in progress - ignoring mark delete on 
position [{}] for cursor [{}]` |
   | end resetting cursor | 
   
   - **[1]**: `PersistentSubscription.expireMessages`
   - **[2]**: `PersistentMessageExpiryMonitor.expireMessages`
   - **[3]**: `PersistentMessageExpiryMonitor.findEntryComplete`
   
   The above concurrency wasted a finding target position, which is a heavy 
operation.
   
   ### Modifications
   
   Release the lock `expirationCheckInProgress` after resetting cursor 
successfully.
   
   ### 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 -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: x
   


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