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


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -1868,7 +1876,12 @@ 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 {
+                    setBatchDeletedIndexes(newPosition);

Review Comment:
   Looks like we just change to 
   
   ```java
   BitSetRecyclable givenBitSet = 
BitSetRecyclable.create().resetWords(newPosition.ackSet);
   batchDeletedIndexes.compute(newPosition,
           (k, v) -> v == null || givenBitSet.nextClearBit(0) > 
v.nextClearBit(0) ?
                   givenBitSet : v);
   ```



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