Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#3903] Add topic validation, forbid sending message to system topic #3904

Merged
merged 2 commits into from
Mar 3, 2022

Conversation

sunxi92
Copy link
Contributor

@sunxi92 sunxi92 commented Mar 1, 2022

Make sure set the target branch to develop

What is the purpose of the change

#3903

Brief changelog

XX

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.

  • Make sure there is a Github issue 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.
  • 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.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • 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.
  • 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.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 51.58% when pulling e5c21b7 on sunxi92:fix_topic_validatation into 7281b5d on apache:develop.

@coveralls
Copy link

coveralls commented Mar 1, 2022

Coverage Status

Coverage increased (+0.02%) to 51.585% when pulling 58647c0 on sunxi92:fix_topic_validatation into 7281b5d on apache:develop.

@@ -60,6 +60,7 @@ public static void checkMessage(Message msg, DefaultMQProducer defaultMQProducer
// topic
Validators.checkTopic(msg.getTopic());
Validators.isNotAllowedSendTopic(msg.getTopic());
Validators.isSystemTopic(msg.getTopic());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may affect the sending of trace messages.

traceProducer.send(message, new MessageQueueSelector() {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right! The topic RMQ_SYS_TRACE_TOPIC should be excluded.

@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2022

Codecov Report

Merging #3904 (58647c0) into develop (799d412) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #3904      +/-   ##
=============================================
+ Coverage      47.45%   47.53%   +0.07%     
- Complexity      4922     4934      +12     
=============================================
  Files            633      633              
  Lines          42498    42520      +22     
  Branches        5579     5582       +3     
=============================================
+ Hits           20166    20210      +44     
+ Misses         19826    19805      -21     
+ Partials        2506     2505       -1     
Impacted Files Coverage Δ
...g/apache/rocketmq/common/topic/TopicValidator.java 97.05% <100.00%> (+0.23%) ⬆️
...org/apache/rocketmq/common/stats/StatsItemSet.java 43.28% <0.00%> (-7.47%) ⬇️
...ache/rocketmq/common/stats/MomentStatsItemSet.java 39.13% <0.00%> (-4.35%) ⬇️
...he/rocketmq/tools/admin/DefaultMQAdminExtImpl.java 39.83% <0.00%> (+0.12%) ⬆️
...mq/client/impl/producer/DefaultMQProducerImpl.java 45.10% <0.00%> (+0.24%) ⬆️
...che/rocketmq/acl/plain/PlainPermissionManager.java 71.94% <0.00%> (+0.25%) ⬆️
.../apache/rocketmq/logging/inner/LoggingBuilder.java 64.71% <0.00%> (+0.31%) ⬆️
...apache/rocketmq/tools/admin/DefaultMQAdminExt.java 41.40% <0.00%> (+0.46%) ⬆️
...n/java/org/apache/rocketmq/store/ha/HAService.java 72.33% <0.00%> (+0.66%) ⬆️
...mmand/connection/ConsumerConnectionSubCommand.java 74.41% <0.00%> (+0.73%) ⬆️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 799d412...58647c0. Read the comment docs.

Copy link
Member

@ShannonDing ShannonDing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@duhenglucky duhenglucky merged commit 5ae4a10 into apache:develop Mar 3, 2022
devfat pushed a commit to devfat/rocketmq that referenced this pull request Mar 3, 2022
…topic (apache#3904)

* Forbid sending message to system topic.

* Forbid sending message to system topic.The topic RMQ_SYS_TRACE_TOPIC should be excluded.
GenerousMan pushed a commit to GenerousMan/rocketmq that referenced this pull request Aug 12, 2022
…topic (apache#3904)

* Forbid sending message to system topic.

* Forbid sending message to system topic.The topic RMQ_SYS_TRACE_TOPIC should be excluded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants