You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "poorbarcode (via GitHub)" <gi...@apache.org> on 2023/02/22 10:00:53 UTC

[GitHub] [pulsar] poorbarcode commented on a diff in pull request #19581: [fix][txn]fix receive duplicated messages due to pendingAcks in PendingAckHandle

poorbarcode commented on code in PR #19581:
URL: https://github.com/apache/pulsar/pull/19581#discussion_r1114093804


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java:
##########
@@ -239,6 +240,21 @@ public int filterEntriesForConsumer(@Nullable MessageMetadata[] metadataArray, i
                                 // if actSet is null, use pendingAck ackSet
                                 ackSet = positionInPendingAck.getAckSet();
                             }
+                            // if the result of pendingAckSet(in pendingAckHandle) AND the ackSet(in cursor) is empty
+                            // filter this entry
+                            if (isAckSetEmpty(ackSet)) {
+                                entries.set(i, null);
+                                entry.release();
+                                continue;
+                            }
+                        } else {
+                            // filter non-batch message in pendingAck state
+                            if (positionInPendingAck.getLedgerId() == entry.getLedgerId()
+                                    && positionInPendingAck.getEntryId() == entry.getEntryId()) {
+                                entries.set(i, null);

Review Comment:
   `if (positionInPendingAck.getLedgerId() == entry.getLedgerId() && positionInPendingAck.getEntryId() == entry.getEntryId())`
   
   This check is unnecessary, 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