Jason918 commented on a change in pull request #14382:
URL: https://github.com/apache/pulsar/pull/14382#discussion_r812692432



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
##########
@@ -448,7 +452,7 @@ public void sendAsync(Message<?> message, SendCallback 
callback) {
                         new PulsarClientException.InvalidMessageException(
                                 format("The producer %s of the topic %s sends 
a %s message with %d bytes that exceeds"
                                                 + " %d bytes",
-                        producerName, topic, compressedStr, compressedSize, 
ClientCnx.getMaxMessageSize()));
+                        producerName, topic, compressedStr, compressedSize, 
chunkMaxMessageSize));

Review comment:
       It seems that we should not change here.  If user set 
`chunkMaxMessageSize` but `isChunkingEnabled` is false, this error log is not 
accurate.

##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
##########
@@ -471,8 +475,8 @@ public void sendAsync(Message<?> message, SendCallback 
callback) {
 
         // send in chunks
         int totalChunks = canAddToBatch(msg) ? 1
-                : Math.max(1, compressedPayload.readableBytes()) / 
ClientCnx.getMaxMessageSize()
-                        + (Math.max(1, compressedPayload.readableBytes()) % 
ClientCnx.getMaxMessageSize() == 0 ? 0 : 1);
+                : Math.max(1, compressedPayload.readableBytes()) / 
chunkMaxMessageSize

Review comment:
       We should apply `chunkMaxMessageSize` only if chunkingEnable == true.




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