congbobo184 commented on code in PR #18531:
URL: https://github.com/apache/pulsar/pull/18531#discussion_r1026403707
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java:
##########
@@ -622,7 +622,18 @@ protected LastCumulativeAck initialValue() {
private boolean flushRequired = false;
public synchronized void update(final MessageIdImpl messageId, final
BitSetRecyclable bitSetRecyclable) {
- if (messageId.compareTo(this.messageId) > 0) {
+ MessageIdImpl newMessageId = messageId;
+ MessageIdImpl lastMessageId = this.messageId;
+ if (newMessageId instanceof BatchMessageIdImpl && !(lastMessageId
instanceof BatchMessageIdImpl)) {
+ lastMessageId =
+ new BatchMessageIdImpl(lastMessageId.ledgerId,
lastMessageId.entryId, lastMessageId.partitionIndex,
+ Integer.MAX_VALUE);
+ } else if (!(newMessageId instanceof BatchMessageIdImpl) &&
(lastMessageId instanceof BatchMessageIdImpl)) {
+ newMessageId =
+ new BatchMessageIdImpl(newMessageId.ledgerId,
newMessageId.entryId, newMessageId.partitionIndex,
+ Integer.MAX_VALUE);
+ }
+ if (newMessageId.compareTo(lastMessageId) > 0) {
Review Comment:
LGTM! one question : why not modify the compareTo method directly?
--
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]