You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "codelipenghui (via GitHub)" <gi...@apache.org> on 2026/10/06 06:25:28 UTC

Re: [PR] [fix][managed-ledger] Persist partial batch ACKs on flush [pulsar]

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


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -2668,9 +2669,14 @@ public void asyncDelete(Iterable<Position> positions, AsyncCallbacks.DeleteCallb
                     log.debug().attr("deletedMessages", individualDeletedMessages).log("Individually deleted messages");
                 } else if (batchDeletedIndexes != null) {
                     final var givenBitSet = BitSet.valueOf(ackSet);
+                    final var existingBitSet = batchDeletedIndexes.get(position);
                     final var bitSet = batchDeletedIndexes.computeIfAbsent(position, __ -> givenBitSet);
-                    if (givenBitSet != bitSet) {
+                    if (existingBitSet == null) {

Review Comment:
   A cumulative ACK can insert a bitmap between get() and computeIfAbsent(), causing this branch to skip the individual ACK merge. A deterministic test gives 6 instead of 4 (6 & 5); it passes on the base. Please retain the merge based on the bitmap returned by computeIfAbsent().



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org