You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/12/05 03:42:51 UTC

[GitHub] [rocketmq] fuyou001 commented on a diff in pull request #5611: [ISSUE #5568] Support long length group and topic for pop mode consumption

fuyou001 commented on code in PR #5611:
URL: https://github.com/apache/rocketmq/pull/5611#discussion_r1039116456


##########
common/src/main/java/org/apache/rocketmq/common/message/MessageExtBrokerInner.java:
##########
@@ -27,6 +27,8 @@ public class MessageExtBrokerInner extends MessageExt {
 
     private ByteBuffer encodedBuff;
 
+    private MessageVersion version = MessageVersion.MESSAGE_VERSION_V1;
+

Review Comment:
   version default null  may be safe.



##########
common/src/main/java/org/apache/rocketmq/common/message/MessageExtBrokerInner.java:
##########
@@ -27,6 +27,8 @@ public class MessageExtBrokerInner extends MessageExt {
 
     private ByteBuffer encodedBuff;
 
+    private MessageVersion version = MessageVersion.MESSAGE_VERSION_V1;

Review Comment:
   version default null may be safe.



##########
broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:
##########
@@ -72,8 +73,14 @@ public static PutMessageResult checkBeforePutMessage(BrokerController brokerCont
         }
 
         final byte[] topicData = msg.getTopic().getBytes(MessageDecoder.CHARSET_UTF8);
+        boolean retryTopic = msg.getTopic() != null && msg.getTopic().startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX);
+        if (!retryTopic && topicData.length > Byte.MAX_VALUE) {
+            LOG.warn("putMessage message topic[{}] length too long {}, but it is not supported by broker",
+                msg.getTopic(), topicData.length);
+            return new PutMessageResult(PutMessageStatus.MESSAGE_ILLEGAL, null);
+        }
 
-        if (topicData.length > Byte.MAX_VALUE) {
+        if (retryTopic && topicData.length > 255) {

Review Comment:
   magic code



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

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