heesung-sn commented on code in PR #20948:
URL: https://github.com/apache/pulsar/pull/20948#discussion_r1290391860
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:
##########
@@ -594,13 +595,18 @@ private void updateMessageMetadata(final MessageMetadata
msgMetadata, final int
}
}
- private long updateMessageMetadataSequenceId(final MessageMetadata
msgMetadata) {
+ private long updateMessageMetadataSequenceId(final MessageMetadata
msgMetadata, boolean isChunk) {
final long sequenceId;
+ // We always need to increment the value of `msgIdGenerator`,
+ // regardless of whether the user has set a sequence ID when sending a
message.
if (!msgMetadata.hasSequenceId()) {
sequenceId = msgIdGenerator++;
msgMetadata.setSequenceId(sequenceId);
+ } else if (isChunk) {
+ sequenceId = msgIdGenerator++;
Review Comment:
I see. Here, we are actually introducing a new concept, `deduplication_id,`
although it is internally still called `sequence_id`.
What if the user sets custom seq_id=5 for one msg and then sets seq_id<=5
for the next message again? This deduplication_id(msgIdGenerator) will be
bigger than 5 here(by chunking), and the second msg will not be deduped. (Do we
have a test case for this?)
--
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]