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


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -1868,7 +1868,15 @@ 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));
+                lock.writeLock().lock();
+                try {
+                    BitSetRecyclable givenBitSet = 
BitSetRecyclable.create().resetWords(newPosition.ackSet);
+                    batchDeletedIndexes.compute(newPosition,
+                            (k, v) -> v == null || givenBitSet.nextSetBit(0) > 
v.nextSetBit(0)
+                                    ? givenBitSet : v);

Review Comment:
   The cumulative ack of batch index, 0 means confirmation, if we want to 
confirm the sub-message with batch index of 3, the batch size is 10, the 
corresponding binary is 1111111000, and the binary bits of the sub-message 
index before the confirmed batch index will also be filled. 



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