merlimat commented on a change in pull request #5491: Fix message deduplicate
issue while using external sequence id with batch produce
URL: https://github.com/apache/pulsar/pull/5491#discussion_r341265357
##########
File path:
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
##########
@@ -367,6 +371,11 @@ public void sendAsync(Message<T> message, SendCallback
callback) {
msgMetadataBuilder.setSequenceId(sequenceId);
} else {
sequenceId = msgMetadataBuilder.getSequenceId();
+ if (sequenceId <= lastSequenceIdPushed) {
+ callback.sendComplete(new PulsarClientException
+ .InvalidMessageException("Message is
definitely a duplicate"));
Review comment:
This is not correct on 2 levels:
1. If `sequenceId <= lastSequenceIdPushed` we don't know yet whether the
message is already dup, because the previous attempt might still fail. This has
to be disambiguated by the broker which has visibility at the storage level.
2. As mentioned before, we cannot throw error when there's a duplicate,
rather we need to return "ok" to the application.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services