liangyepianzhou commented on code in PR #20948:
URL: https://github.com/apache/pulsar/pull/20948#discussion_r1289985433


##########
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:
   This sequence ID is an intermediate variable. User-defined sequence IDs will 
not be overwritten.



-- 
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]

Reply via email to