heesung-sn commented on code in PR #20948:
URL: https://github.com/apache/pulsar/pull/20948#discussion_r1286136044
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:
##########
@@ -594,9 +595,9 @@ 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;
- if (!msgMetadata.hasSequenceId()) {
+ if (!msgMetadata.hasSequenceId() || isChunk) {
Review Comment:
It seems like we are overriding cx provided sequence id here, if chunked.
Are we allowed to do this?
##########
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, chunkUUid) : null;
Review Comment:
- Why do we need to use uuid here? isn't `String.format("%s-%d",
producerName, sequenceId)` unique already for each chunk?
- do we need to worry about any uuid collision?
##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/MessageChunkingSharedTest.java:
##########
@@ -211,6 +212,32 @@ private static String createChunkedMessage(int numChunks) {
return Schema.STRING.decode(payload);
}
Review Comment:
Add a case when user provides sequence ids and how the messages are chunked
and deduped.
--
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]