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/09/11 05:17:51 UTC
[GitHub] [rocketmq] mxsm opened a new pull request, #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
mxsm opened a new pull request, #5048:
URL: https://github.com/apache/rocketmq/pull/5048
**Make sure set the target branch to `develop`**
## What is the purpose of the change
close #5047
## Brief changelog
- Modify MessageStoreConfig attribute maxTopicLength default value
- remove duplicated code in HookUtils
## Verifying this change
XXXX
Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
- [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
- [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
- [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test` to make sure integration-test pass.
- [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
--
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
[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#discussion_r967924871
##########
broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:
##########
@@ -74,12 +74,7 @@ public static PutMessageResult checkBeforePutMessage(BrokerController brokerCont
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) {
+ if (topicLength > Byte.MAX_VALUE || topicLength > brokerController.getMessageStoreConfig().getMaxTopicLength()) {
Review Comment:
Hello @mxsm ,
It seems same judgment logic of two condition
--
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
[GitHub] [rocketmq] mxsm commented on a diff in pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#discussion_r968209106
##########
broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:
##########
@@ -74,12 +74,7 @@ public static PutMessageResult checkBeforePutMessage(BrokerController brokerCont
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) {
+ if (topicLength > Byte.MAX_VALUE || topicLength > brokerController.getMessageStoreConfig().getMaxTopicLength()) {
Review Comment:
if remove `topicLength > Byte.MAX_VALUE` and config file set `maxTopicLength = 1000`. broker will can not save。 So I think it is necessary.
@RongtongJin @Oliverwqcwrw
--
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
[GitHub] [rocketmq] codecov-commenter commented on pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#issuecomment-1242891778
# [Codecov](https://codecov.io/gh/apache/rocketmq/pull/5048?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#5048](https://codecov.io/gh/apache/rocketmq/pull/5048?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e9ec0f6) into [develop](https://codecov.io/gh/apache/rocketmq/commit/f8bf7bd38b11ca025c5795a8e4a03bd577f47273?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f8bf7bd) will **increase** coverage by `0.03%`.
> The diff coverage is `66.66%`.
```diff
@@ Coverage Diff @@
## develop #5048 +/- ##
=============================================
+ Coverage 43.21% 43.25% +0.03%
- Complexity 7764 7766 +2
=============================================
Files 995 995
Lines 69113 69107 -6
Branches 9152 9150 -2
=============================================
+ Hits 29869 29889 +20
+ Misses 35490 35455 -35
- Partials 3754 3763 +9
```
| [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/5048?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...ava/org/apache/rocketmq/broker/util/HookUtils.java](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvdXRpbC9Ib29rVXRpbHMuamF2YQ==) | `12.96% <50.00%> (+0.68%)` | :arrow_up: |
| [...ache/rocketmq/store/config/MessageStoreConfig.java](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2NvbmZpZy9NZXNzYWdlU3RvcmVDb25maWcuamF2YQ==) | `58.70% <100.00%> (ø)` | |
| [...ketmq/common/protocol/body/ConsumerConnection.java](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vcHJvdG9jb2wvYm9keS9Db25zdW1lckNvbm5lY3Rpb24uamF2YQ==) | `95.83% <0.00%> (-4.17%)` | :arrow_down: |
| [...ketmq/client/impl/consumer/PullMessageService.java](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9QdWxsTWVzc2FnZVNlcnZpY2UuamF2YQ==) | `49.23% <0.00%> (-3.08%)` | :arrow_down: |
| [...va/org/apache/rocketmq/store/util/PerfCounter.java](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL3V0aWwvUGVyZkNvdW50ZXIuamF2YQ==) | `64.39% <0.00%> (-2.10%)` | :arrow_down: |
| [...mq/client/impl/consumer/RebalanceLitePullImpl.java](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9SZWJhbGFuY2VMaXRlUHVsbEltcGwuamF2YQ==) | `69.86% <0.00%> (-1.37%)` | :arrow_down: |
| [...ache/rocketmq/proxy/common/ReceiptHandleGroup.java](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJveHkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3Byb3h5L2NvbW1vbi9SZWNlaXB0SGFuZGxlR3JvdXAuamF2YQ==) | `65.47% <0.00%> (-1.20%)` | :arrow_down: |
| [...he/rocketmq/controller/impl/DLedgerController.java](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvY29udHJvbGxlci9pbXBsL0RMZWRnZXJDb250cm9sbGVyLmphdmE=) | `65.96% <0.00%> (-0.53%)` | :arrow_down: |
| [.../org/apache/rocketmq/store/ha/DefaultHAClient.java](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL0RlZmF1bHRIQUNsaWVudC5qYXZh) | `61.02% <0.00%> (-0.52%)` | :arrow_down: |
| [...he/rocketmq/client/trace/AsyncTraceDispatcher.java](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvdHJhY2UvQXN5bmNUcmFjZURpc3BhdGNoZXIuamF2YQ==) | `82.85% <0.00%> (-0.48%)` | :arrow_down: |
| ... and [17 more](https://codecov.io/gh/apache/rocketmq/pull/5048/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
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
[GitHub] [rocketmq] mxsm commented on a diff in pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#discussion_r969061000
##########
broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:
##########
@@ -74,12 +74,7 @@ public static PutMessageResult checkBeforePutMessage(BrokerController brokerCont
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) {
+ if (topicLength > Byte.MAX_VALUE || topicLength > brokerController.getMessageStoreConfig().getMaxTopicLength()) {
Review Comment:
> IMO, we should deprecate maxTopicLength config and comment on it, and finally remove this config in the future release.
I prefer this approach. I will resubmit code to fix it
--
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
[GitHub] [rocketmq] RongtongJin commented on a diff in pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
RongtongJin commented on code in PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#discussion_r969055775
##########
broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:
##########
@@ -74,12 +74,7 @@ public static PutMessageResult checkBeforePutMessage(BrokerController brokerCont
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) {
+ if (topicLength > Byte.MAX_VALUE || topicLength > brokerController.getMessageStoreConfig().getMaxTopicLength()) {
Review Comment:
IMO, we should deprecate maxTopicLength config and comment on it, and finally remove this config in the future release.
--
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
[GitHub] [rocketmq] RongtongJin commented on a diff in pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
RongtongJin commented on code in PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#discussion_r969053629
##########
broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:
##########
@@ -74,12 +74,7 @@ public static PutMessageResult checkBeforePutMessage(BrokerController brokerCont
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) {
+ if (topicLength > Byte.MAX_VALUE || topicLength > brokerController.getMessageStoreConfig().getMaxTopicLength()) {
Review Comment:
> topicLength
OK, I find that even if it is not verified here, other places will verify that topic length does not exceed 127. So the maxTopicLength in messageStoreConfig is useless unless it is set to be less than 127.
--
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
[GitHub] [rocketmq] mxsm commented on a diff in pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#discussion_r968209442
##########
store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java:
##########
@@ -239,7 +239,7 @@ public class MessageStoreConfig {
private boolean recheckReputOffsetFromCq = false;
// Maximum length of topic
- private int maxTopicLength = 1000;
+ private int maxTopicLength = 127;
Review Comment:
> It would be better to use `Byte.MAX_VALUE` to represent 127
Good idea
--
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
[GitHub] [rocketmq] mxsm commented on a diff in pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#discussion_r969060536
##########
broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:
##########
@@ -74,12 +74,7 @@ public static PutMessageResult checkBeforePutMessage(BrokerController brokerCont
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) {
+ if (topicLength > Byte.MAX_VALUE || topicLength > brokerController.getMessageStoreConfig().getMaxTopicLength()) {
Review Comment:
> > topicLength
>
> OK, I find that even if it is not verified here, other places will verify that topic length does not exceed 127. So the maxTopicLength in messageStoreConfig is useless unless it is set to be less than 127.
IMO, we add PutMessageHook to handle message which before put, so we should verify the length of the topic in PutMessageHook
--
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
[GitHub] [rocketmq] ShannonDing commented on pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
ShannonDing commented on PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#issuecomment-1250497205
link 5112
--
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
[GitHub] [rocketmq] RongtongJin merged pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
RongtongJin merged PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048
--
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
[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#discussion_r969047279
##########
broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:
##########
@@ -74,12 +74,7 @@ public static PutMessageResult checkBeforePutMessage(BrokerController brokerCont
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) {
+ if (topicLength > Byte.MAX_VALUE || topicLength > brokerController.getMessageStoreConfig().getMaxTopicLength()) {
Review Comment:
IMO, The `topicLength > Byte.MAX_VALUE` can be removed regardless of whether `maxTopicLength` is dynamically modifiable
--
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
[GitHub] [rocketmq] RongtongJin commented on a diff in pull request #5048: [ISSUE #5047]Modify MessageStoreConfig attribute maxTopicLength default value
Posted by GitBox <gi...@apache.org>.
RongtongJin commented on code in PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#discussion_r968178398
##########
store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java:
##########
@@ -239,7 +239,7 @@ public class MessageStoreConfig {
private boolean recheckReputOffsetFromCq = false;
// Maximum length of topic
- private int maxTopicLength = 1000;
+ private int maxTopicLength = 127;
Review Comment:
It would be better to use `Byte.MAX_VALUE` to represent 127
##########
broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:
##########
@@ -74,12 +74,7 @@ public static PutMessageResult checkBeforePutMessage(BrokerController brokerCont
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) {
+ if (topicLength > Byte.MAX_VALUE || topicLength > brokerController.getMessageStoreConfig().getMaxTopicLength()) {
Review Comment:
How about removing `topicLength > Byte.MAX_VALUE`?
--
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