shengminw commented on code in PR #4469:
URL: https://github.com/apache/rocketmq/pull/4469#discussion_r903233707


##########
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:
   Yes, get to this step, properties(max 32kb) and topic name(max 127 bytes) 
are limited. But the full message length still may exceed 
4M(maxMessageBodySize).
   About whether it is neccessary to do this change, it's worth discussing. I 
think, in the previous version, maxMessageBodySize is also used to limit buffer 
length. So from my point of view, I think it is necessary to add.



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