forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed ordering issue in KeyShared dispatcher when adding consumer (ap…
…ache#7106) ### Motivation Fixes: apache#6554 Ordering is broken in KeyShared dispatcher if a new consumer `c2` comes in and an existing consumer `c1` goes out. This is because messages with keys previously assigned to `c1` may now route to `c2`. The solution here is to have new consumers joining in a "paused" state. For example, consider this sequence: 1. Subscriptions has `c1` and `c2` consumers 2. `c3` joins. Some of the keys are now supposed to go to `c3`. 3. Instead of starting delivering to `c3`. We mark the current readPosition (let's call it `rp0_c3`) of the cursor for `c3`. 4. Any message that now hashes to `c3` and that has `messageId >= rp0_c3` will be deferred for later re-delivery 5. Any message that might get re-delivered (eg: originally sent to `c1`, but `c1` has failed) to `c3` and that has `messageId < rp0_c3` will be sent to `c3` 6. When the markDelete position of the cursor will move past `rp0_c3` the restriction on `c3` will be lifted. Essentially, `c3` joins but can only receive old messages, until everything that was read before joining gets acked.
- Loading branch information
1 parent
7e76a73
commit 752ce14
Showing
4 changed files
with
189 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters