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/11/21 06:17:43 UTC
[GitHub] [pulsar] coderzc commented on a diff in pull request #18486: [fix] Avoid redelivering duplicated messages when batching is enabled
coderzc commented on code in PR #18486:
URL: https://github.com/apache/pulsar/pull/18486#discussion_r1027614402
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java:
##########
@@ -656,6 +662,19 @@ public synchronized void reset() {
flushRequired = false;
}
+ public synchronized int compareTo(MessageId messageId) {
+ // The position of a message in the batch (BatchMessageIdImpl) must precede the batch itself (MessageIdImpl)
+ if (this.messageId instanceof BatchMessageIdImpl && (!(messageId instanceof BatchMessageIdImpl))) {
+ int result = ((BatchMessageIdImpl) this.messageId).toMessageIdImpl().compareTo(messageId);
Review Comment:
We can transform `messageId` to `BatchMessageIdImpl`, and `batchIndex = Integer.MAX_VALUE`
--
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