Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix data lost when using earliest position to subscribe to a topic (#…
…11547) When subscribing to a topic with earliest position, the ManagedLedger always using the last position to init the cursor. If the no cursor update happens and the broker restarts or topic been unloaded or the topic ownership changed, will lead to the data lost, the unacked messages will not redeliver to the consumer again. The root cause is if we are using the last position to init the cursor, the cursor will update the mark delete position as the last position first to the Zookeeper, if the cursor can't a chance to update the mark delete position again before been closed, when recoving the cursor again, will using the mark delete posiion that stored in the Zookeeper, so the issue happens. The fix is to add check for the initial position of the cursor, if we are using the Earliest as the initial position, use the first position to init the cursor. The new added test can cover the changes, and without this change, the test would failed. (cherry picked from commit 035a6ba)
- Loading branch information
1 parent
454da89
commit cf526bf
Showing
2 changed files
with
56 additions
and
1 deletion.
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