codelipenghui commented on code in PR #21268:
URL: https://github.com/apache/pulsar/pull/21268#discussion_r1381741332
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:
##########
@@ -2800,12 +2806,34 @@ private CompletableFuture<Void>
doTransactionAcknowledgeForResponse(MessageId me
} else {
bitSetRecyclable.clear(messageIdAdv.getBatchIndex());
}
- cmd = Commands.newAck(consumerId, ledgerId, entryId,
bitSetRecyclable, ackType, validationError, properties,
- txnID.getLeastSigBits(), txnID.getMostSigBits(),
requestId, messageIdAdv.getBatchSize());
+ cmdList.add(Commands.newAck(consumerId, ledgerId, entryId,
bitSetRecyclable, ackType, validationError, properties,
+ txnID.getLeastSigBits(), txnID.getMostSigBits(),
requestId, messageIdAdv.getBatchSize()));
Review Comment:
We can use one Ack command to ack multiple individual messages
https://github.com/apache/pulsar/blob/99e6aebb88c8ea82c8b8d65261ce71f0ab8d36d8/pulsar-common/src/main/proto/PulsarApi.proto#L563
Why do we need to create multiple ack commands?
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:
##########
@@ -2800,12 +2806,34 @@ private CompletableFuture<Void>
doTransactionAcknowledgeForResponse(MessageId me
} else {
bitSetRecyclable.clear(messageIdAdv.getBatchIndex());
}
- cmd = Commands.newAck(consumerId, ledgerId, entryId,
bitSetRecyclable, ackType, validationError, properties,
- txnID.getLeastSigBits(), txnID.getMostSigBits(),
requestId, messageIdAdv.getBatchSize());
+ cmdList.add(Commands.newAck(consumerId, ledgerId, entryId,
bitSetRecyclable, ackType, validationError, properties,
+ txnID.getLeastSigBits(), txnID.getMostSigBits(),
requestId, messageIdAdv.getBatchSize()));
bitSetRecyclable.recycle();
} else {
- cmd = Commands.newAck(consumerId, ledgerId, entryId, null,
ackType, validationError, properties,
- txnID.getLeastSigBits(), txnID.getMostSigBits(),
requestId);
+ MessageIdImpl[] chunkMsgIds =
this.unAckedChunkedMessageIdSequenceMap.remove(messageIdAdv);
+ // cumulative ack chunk by the last messageId
+ if (chunkMsgIds == null || ackType == AckType.Cumulative) {
+ cmdList.add(Commands.newAck(consumerId, ledgerId, entryId,
null, ackType, validationError,
+ properties, txnID.getLeastSigBits(),
txnID.getMostSigBits(), requestId));
Review Comment:
Same as the above comment.
--
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]