poorbarcode commented on code in PR #21048:
URL: https://github.com/apache/pulsar/pull/21048#discussion_r1310025536
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:
##########
@@ -695,6 +695,12 @@ private void serializeAndSendMessage(MessageImpl<?> msg,
op = OpSendMsg.create(msg, null, sequenceId, callback);
final MessageMetadata finalMsgMetadata = msgMetadata;
op.rePopulate = () -> {
+ if (msgMetadata.hasChunkId()) {
+ // The message metadata is shared between all chunks
in a large message
+ // We need to reset the chunk id for each call of this
method
+ // It's safe to do that because there is only 1 thread
to manipulate this message metadata
+ finalMsgMetadata.setChunkId(chunkId);
Review Comment:
<del>- Since multiple chunks use the same message meta, the chunk ID must be
reset when resending messages, right?<sup>[1]</sup>
- So it's solving a different problem, right?<sup>[2]</sup> </del>
Sorry, I saw you explained this in the Motivation, please ignore this comment
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:
##########
@@ -695,6 +695,12 @@ private void serializeAndSendMessage(MessageImpl<?> msg,
op = OpSendMsg.create(msg, null, sequenceId, callback);
final MessageMetadata finalMsgMetadata = msgMetadata;
op.rePopulate = () -> {
+ if (msgMetadata.hasChunkId()) {
+ // The message metadata is shared between all chunks
in a large message
+ // We need to reset the chunk id for each call of this
method
+ // It's safe to do that because there is only 1 thread
to manipulate this message metadata
+ finalMsgMetadata.setChunkId(chunkId);
Review Comment:
<del>- Since multiple chunks use the same message meta, the chunk ID must be
reset when resending messages, right?<sup>[1]</sup></del>
<del>- So it's solving a different problem, right?<sup>[2]</sup>
Sorry, I saw you explained this in the Motivation, please ignore this comment
--
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]