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


##########
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:
   what about adding a DEBUG statement here ?



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -2097,6 +2102,22 @@ public void markDeleteFailed(ManagedLedgerException 
exception, Object ctx) {
         }
     }
 
+    // update lastMarkDeleteEntry field if newPosition is later than the 
current lastMarkDeleteEntry.newPosition
+    private void updateLastMarkDeleteEntryToLatest(final PositionImpl 
newPosition,
+                                                   final Map<String, Long> 
properties) {
+        LAST_MARK_DELETE_ENTRY_UPDATER.updateAndGet(this, last -> {
+            if (last != null && last.newPosition.compareTo(newPosition) > 0) {
+                // keep current value, don't update

Review Comment:
   what about adding a DEBUG statement here ?



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