You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/10/21 14:01:36 UTC

[GitHub] [pulsar] congbobo184 commented on a diff in pull request #18154: [fix][client] In method LastCumulativeAck#update, bitSetRecyclable does not update when messageId is equal.

congbobo184 commented on code in PR #18154:
URL: https://github.com/apache/pulsar/pull/18154#discussion_r1001827854


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java:
##########
@@ -658,6 +658,16 @@ protected LastCumulativeAck initialValue() {
     private boolean flushRequired = false;
 
     public synchronized void update(final MessageIdImpl messageId, final BitSetRecyclable bitSetRecyclable) {
+        if (messageId.equals(this.messageId)) {
+            if (this.bitSetRecyclable != null && bitSetRecyclable != null
+                    && bitSetRecyclable.nextSetBit(0) > this.bitSetRecyclable.nextSetBit(0)) {
+                this.bitSetRecyclable.recycle();
+                set(messageId, bitSetRecyclable);
+                flushRequired = true;
+            }
+            return;
+        }
+
         if (messageId.compareTo(this.messageId) > 0) {

Review Comment:
   seem compareTo has already compare the batchIndex. https://github.com/apache/pulsar/blob/fa328a42d5770a27237d926eac97385284876174/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageIdImpl.java#L248-L253 so we don't need to do single check, right?



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