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/30 02:49:18 UTC

[GitHub] [rocketmq] dongeforever commented on a diff in pull request #4521: [ISSUE#4520] [Optimization] Implenment adjusting maxMessageSize dynamicly

dongeforever commented on code in PR #4521:
URL: https://github.com/apache/rocketmq/pull/4521#discussion_r910559096


##########
store/src/main/java/org/apache/rocketmq/store/CommitLog.java:
##########
@@ -604,6 +604,14 @@ private String generateKey(StringBuilder keyBuilder, MessageExt messageExt) {
         return keyBuilder.toString();
     }
 
+    public void updateMaxMessageSize(PutMessageThreadLocal putMessageThreadLocal) {
+        // dynamically adjust maxMessageSize, but not support DLedger mode temporarily
+        int newMaxMessageSize = this.defaultMessageStore.getMessageStoreConfig().getMaxMessageSize();
+        if (putMessageThreadLocal.getEncoder().getMaxMessageBodySize() != newMaxMessageSize) {
+            putMessageThreadLocal.getEncoder().updateEncoderBufferCapacity(newMaxMessageSize);
+        }

Review Comment:
   It is better to do some checks to prevent negeative values.
   
   if (newMaxMessageSize < 10) {
     return
   }



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