You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/06/22 01:57:22 UTC

[GitHub] [rocketmq] ni-ze commented on a diff in pull request #4469: [ISSUE#4468] Optimize broker buffer length initialization

ni-ze commented on code in PR #4469:
URL: https://github.com/apache/rocketmq/pull/4469#discussion_r903208342


##########
store/src/main/java/org/apache/rocketmq/store/CommitLog.java:
##########
@@ -1482,11 +1482,15 @@ public static class MessageExtEncoder {
         private final ByteBuf byteBuf;
         // The maximum length of the message body.
         private final int maxMessageBodySize;
-
+        // The maximum length of the full message.
+        private final int maxMessageSize;
         MessageExtEncoder(final int maxMessageBodySize) {
             ByteBufAllocator alloc = UnpooledByteBufAllocator.DEFAULT;
-            byteBuf = alloc.directBuffer(maxMessageBodySize);
+            //Reserve 64kb for encoding buffer outside body
+            int maxMessageSize = maxMessageBodySize + 64 * 1024;

Review Comment:
   IMO, variable parameters, which is properties and topic name, is limited and properties before write into commitLog, if this two item length exceed limit, it won't reach here.
   
   and I think it is a little weird to limit length base on an auto scalable ByteBuf.



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org