merlimat commented on code in PR #15033:
URL: https://github.com/apache/pulsar/pull/15033#discussion_r882028551


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageContainerImpl.java:
##########
@@ -69,8 +69,7 @@ public boolean add(MessageImpl<?> msg, SendCallback callback) 
{
                 messageMetadata.setSequenceId(msg.getSequenceId());
                 lowestSequenceId = 
Commands.initBatchMessageMetadata(messageMetadata, msg.getMessageBuilder());
                 this.firstCallback = callback;
-                batchedMessageMetadataAndPayload = 
PulsarByteBufAllocator.DEFAULT
-                        .buffer(Math.min(maxBatchSize, 
ClientCnx.getMaxMessageSize()));
+                batchedMessageMetadataAndPayload = 
PulsarByteBufAllocator.DEFAULT.compositeBuffer();

Review Comment:
   This approach could result in many buffer expansions when the average buffer 
size is larger than the "default" size of allocated buffers.



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