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

   ### Motivation
   
   **Background**
   - After all, consumers are off-line, the cursor will be triggered a `rewind`
     - If there is a pending read is in-progress, the action `rewind` will be 
delayed after the pending read is complete. 
   - The variable `dispatcher.recentlyJoinedConsumers` of `key_shared` mode 
guarantees delivery in order, it records the `cursor.readPosition` when 
consumers join.
   
   **Issue**: a case that makes items in `dispatcher.recentlyJoinedConsumers` 
out-of-order, the steps to reproduce the issue are as follows:
   - there are `3` consumers: `c1`, `c2`, `c3`
     - `c1` and `c2` consumed all messages that they received.
     - `c3` is stuck
     - `LAC`: `3:299`, `cursor.readPosition`: `3:300`, `mard-deleted-position`: 
`3:100`
   - The dispatcher will replay the messages that were sent to `c3` after `c3` 
is removed.
     -   At the moment, `c1` and `c2` are also off-line, which will trigger a 
`rewind`
     - Since there is a pending read, the `rewind` will be delayed.
   - `consumer-4` joined, its `recentlyJoinedPosition` was set to `3:300`
   - The delayed `rewind` was triggered.
     -  `LAC`: `3:299`, `cursor.readPosition`: `3:101`, 
`mard-deleted-position`: `3:100`
   - `consumer-5` joined, its `recentlyJoinedPosition` was set to `3:101`
   - The issue occured.
   
   ### Modifications
   
   - After the delayed `rewind` was executed, clear the collection 
`dispatcher.recentlyJoinedConsumers`
   
   ### 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