codelipenghui opened a new pull request #11547:
URL: https://github.com/apache/pulsar/pull/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.
   
   


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