You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by ji...@apache.org on 2022/09/19 08:59:33 UTC
[rocketmq] branch develop updated: [ISSUE #5047] Modify MessageStoreConfig attribute maxTopicLength default value (#5048)
This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new d1ca7744d [ISSUE #5047] Modify MessageStoreConfig attribute maxTopicLength default value (#5048)
d1ca7744d is described below
commit d1ca7744db5b1d12b0497aa90dea900f9ac9d12c
Author: mxsm <lj...@gmail.com>
AuthorDate: Mon Sep 19 16:59:26 2022 +0800
[ISSUE #5047] Modify MessageStoreConfig attribute maxTopicLength default value (#5048)
---
.../org/apache/rocketmq/broker/util/HookUtils.java | 19 ++++++-------------
.../rocketmq/store/config/MessageStoreConfig.java | 8 ++++++--
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java b/broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java
index f8a5f6789..13f086130 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java
@@ -74,11 +74,6 @@ public class HookUtils {
final byte[] topicData = msg.getTopic().getBytes(MessageDecoder.CHARSET_UTF8);
final int topicLength = topicData == null ? 0 : topicData.length;
- if (topicLength > brokerController.getMessageStoreConfig().getMaxTopicLength()) {
- LOG.warn("putMessage message topic[{}] length too long {}", msg.getTopic(), topicLength);
- return new PutMessageResult(PutMessageStatus.MESSAGE_ILLEGAL, null);
- }
-
if (topicLength > Byte.MAX_VALUE) {
LOG.warn("putMessage message topic[{}] length too long {}, but it is not supported by broker",
msg.getTopic(), topicLength);
@@ -90,11 +85,6 @@ public class HookUtils {
return new PutMessageResult(PutMessageStatus.MESSAGE_ILLEGAL, null);
}
- if (msg.getBody() == null) {
- LOG.warn("putMessage message topic[{}], but message body is null", msg.getTopic());
- return new PutMessageResult(PutMessageStatus.MESSAGE_ILLEGAL, null);
- }
-
if (brokerController.getMessageStore().isOSPageCacheBusy()) {
return new PutMessageResult(PutMessageStatus.OS_PAGE_CACHE_BUSY, null);
}
@@ -123,7 +113,7 @@ public class HookUtils {
final MessageExtBrokerInner msg) {
final int tranType = MessageSysFlag.getTransactionValue(msg.getSysFlag());
if (tranType == MessageSysFlag.TRANSACTION_NOT_TYPE
- || tranType == MessageSysFlag.TRANSACTION_COMMIT_TYPE) {
+ || tranType == MessageSysFlag.TRANSACTION_COMMIT_TYPE) {
if (!isRolledTimerMessage(msg)) {
if (checkIfTimerMessage(msg)) {
if (!brokerController.getMessageStoreConfig().isTimerWheelEnable()) {
@@ -138,11 +128,12 @@ public class HookUtils {
}
// Delay Delivery
if (msg.getDelayTimeLevel() > 0) {
- transformDelayLevelMessage(brokerController,msg);
+ transformDelayLevelMessage(brokerController, msg);
}
}
return null;
}
+
private static boolean isRolledTimerMessage(MessageExtBrokerInner msg) {
return TimerMessageStore.TIMER_TOPIC.equals(msg.getTopic());
}
@@ -167,7 +158,9 @@ public class HookUtils {
}
return null != msg.getProperty(MessageConst.PROPERTY_TIMER_DELIVER_MS) || null != msg.getProperty(MessageConst.PROPERTY_TIMER_DELAY_MS) || null != msg.getProperty(MessageConst.PROPERTY_TIMER_DELAY_SEC);
}
- private static PutMessageResult transformTimerMessage(BrokerController brokerController, MessageExtBrokerInner msg) {
+
+ private static PutMessageResult transformTimerMessage(BrokerController brokerController,
+ MessageExtBrokerInner msg) {
//do transform
int delayLevel = msg.getDelayTimeLevel();
long deliverMs;
diff --git a/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java b/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java
index 1d5b73336..11b11d851 100644
--- a/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java
+++ b/store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java
@@ -238,8 +238,10 @@ public class MessageStoreConfig {
//For recheck the reput
private boolean recheckReputOffsetFromCq = false;
- // Maximum length of topic
- private int maxTopicLength = 1000;
+ // Maximum length of topic, it will be removed in the future release
+ @Deprecated
+ private int maxTopicLength = Byte.MAX_VALUE;
+
private int travelCqFileNumWhenGetMessage = 1;
// Sleep interval between to corrections
private int correctLogicMinOffsetSleepInterval = 1;
@@ -465,10 +467,12 @@ public class MessageStoreConfig {
this.maxMessageSize = maxMessageSize;
}
+ @Deprecated
public int getMaxTopicLength() {
return maxTopicLength;
}
+ @Deprecated
public void setMaxTopicLength(int maxTopicLength) {
this.maxTopicLength = maxTopicLength;
}