lordcheng10 commented on code in PR #18042:
URL: https://github.com/apache/pulsar/pull/18042#discussion_r998909808


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -1868,7 +1868,13 @@ public void asyncMarkDelete(final Position position, 
Map<String, Long> propertie
 
         if (config.isDeletionAtBatchIndexLevelEnabled() && batchDeletedIndexes 
!= null) {
             if (newPosition.ackSet != null) {
-                batchDeletedIndexes.put(newPosition, 
BitSetRecyclable.create().resetWords(newPosition.ackSet));
+                BitSetRecyclable givenBitSet = 
BitSetRecyclable.create().resetWords(newPosition.ackSet);
+                // In order to prevent the batch index recorded in 
batchDeletedIndexes from rolling back,
+                // only update batchDeletedIndexes when the submitted batch 
index is greater
+                // than the recorded index.
+                batchDeletedIndexes.compute(newPosition,
+                        (k, v) -> v == null || givenBitSet.nextSetBit(0) > 
v.nextSetBit(0)
+                                ? givenBitSet : v);

Review Comment:
   OK, I will fix



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