lhotari commented on code in PR #15031:
URL: https://github.com/apache/pulsar/pull/15031#discussion_r842895246


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -1796,7 +1796,14 @@ void internalMarkDelete(final MarkDeleteEntry mdEntry) {
         // ledger is postponed to when the counter goes to 0.
         PENDING_MARK_DELETED_SUBMITTED_COUNT_UPDATER.incrementAndGet(this);
 
-        lastMarkDeleteEntry = mdEntry;
+        LAST_MARK_DELETE_ENTRY_UPDATER.updateAndGet(this, last -> {
+            if (last != null && 
last.newPosition.compareTo(mdEntry.newPosition) > 0) {
+                // keep the current value since it's later then the 
mdEntry.newPosition

Review Comment:
   Do you mean something like this?
   ```java
                   if (log.isDebugEnabled()) {
                       log.debug("Keeping {} since it's newer than {}", last, 
mdEntry);
                   }
   ```
   



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