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

   ### Motivation
   
   The issue was in `maybeUpdateCursorBeforeTrimmingConsumedLedger` where it 
called `onCursorMarkDeletePositionUpdated`, which only updates the in-memory 
cursor position without persisting it to the metadata store. If the broker 
crashes after this update, it will recover the old mark deletion position, 
which leads to confusion as the trimmed ledgers may still be referenced by the 
cursor.
   
   ### Modifications
   
   - Changed `maybeUpdateCursorBeforeTrimmingConsumedLedger` to call 
`asyncMarkDelete` instead of `onCursorMarkDeletePositionUpdated`
   - This triggers actual persistence of the cursor's mark delete position to 
the metadata store
   - Preserved cursor properties by passing `cursor.getProperties()` instead of 
an empty map
   - Updated test `testTrimmerRaceCondition` to verify:
     - The cursor position is properly persisted after ledger rollover
     - Cursor properties are preserved during the cursor reset operation
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   This change is already covered by existing test:
   - `ManagedLedgerTest.testTrimmerRaceCondition` - Enhanced to verify cursor 
position persistence and property preservation


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