heesung-sn commented on code in PR #20948:
URL: https://github.com/apache/pulsar/pull/20948#discussion_r1289536694
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:
##########
@@ -553,9 +555,8 @@ public void sendAsync(Message<?> message, SendCallback
callback) {
synchronized (this) {
// Update the message metadata before computing the
payload chunk size
// to avoid a large message cannot be split into chunks.
- final long sequenceId =
updateMessageMetadataSequenceId(msgMetadata);
- String uuid = totalChunks > 1 ? String.format("%s-%d",
producerName, sequenceId) : null;
-
+ final long sequenceId =
updateMessageMetadataSequenceId(msgMetadata, chunkId > 0);
+ String uuid = totalChunks > 1 ? String.format("%s-%s",
producerName, sequenceId - chunkId) : null;
Review Comment:
Shouldn't chunk uuid be the same for all chunks per message?
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:
##########
@@ -531,6 +532,7 @@ public void sendAsync(Message<?> message, SendCallback
callback) {
? msg.getMessageBuilder().getOrderingKey() : null;
// msg.messageId will be reset if previous message chunk is sent
successfully.
final MessageId messageId = msg.getMessageId();
+ final UUID chunkUUid = UUID.randomUUID();
Review Comment:
Where do we use this uuid? Plz remove it if not used.
##########
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:
It seems like this change still overrides custom seq_id here if chunking is
on.
I guess we need a quick community discussion for this behavior change?
--
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]