Conversation
…try topics KeyBuilder.buildPopRetryTopicV2() generates retry topics using '+' as the separator between consumer group and topic (POP_RETRY_SEPARATOR_V2), e.g. %RETRY%<cid>+<topic>. However TopicValidator.VALID_CHAR_BIT_MAP did not allow '+', so brokers with enableRetryTopicV2 rejected these generated topics as containing illegal characters. Add '+' to VALID_CHAR_BIT_MAP and update the error messages accordingly. Signed-off-by: jokerzsd <2701819133@qq.com>
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR modifies 2 files (+13/-3) in apache/rocketmq.
Observations
- Diff size: 59 lines — moderate change, recommend careful review
- Test coverage: ✅ Test files included
Recommendations
- Please ensure backward compatibility if any public API is modified
- Verify thread safety for any concurrent code paths
- Confirm error handling is adequate for new code paths
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Fixes #11158. KeyBuilder.buildPopRetryTopicV2() generates V2 pop retry topics using + as the separator (POP_RETRY_SEPARATOR_V2), producing names like %RETRY%<cid>+<topic>. However TopicValidator.VALID_CHAR_BIT_MAP did not include +, so brokers with enableRetryTopicV2=true rejected these auto-generated topics with "contains illegal characters".
The fix adds + to the valid character set and updates the regex comments and error messages accordingly. Test covers the V2 retry topic scenario.
One consideration: since isTopicOrGroupIllegal() is shared between topic and group validation, this also allows + in consumer group names. This is a broader change than strictly needed for the V2 retry topic fix, but unlikely to cause issues in practice — and consistency between topic/group character sets is generally desirable.
LGTM.
Automated review by github-manager-bot
|
The validation mismatch for V2 retry topics is real. Please keep Adding The current A scoped fix would recognize Please also cover valid V2 retry topics, |
Keep '+' forbidden in ordinary topic and group names, and add dedicated validation for V2 pop retry topics (%RETRY%<group>+<topic>) that requires exactly one '+' separator and non-empty, valid group/topic components. This avoids ambiguous retry-topic names such as %RETRY%A+B+C that would otherwise collide when group or topic themselves contain '+'. Signed-off-by: jokerzsd <2701819133@qq.com>
|
Thanks for the detailed review, @qianye1001. Agreed — allowing
Regression tests now cover: a valid V2 retry topic,
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
The updated implementation looks great. Instead of broadly allowing + in the valid character map, this version introduces a dedicated validatePopRetryTopicV2() that:
- Detects V2 retry topics by checking for the
%RETRY%prefix and+separator - Validates the structure: exactly one
+separating a valid consumer group and a valid topic - Enforces length constraints on the composite retry topic name
- Keeps
+rejected in ordinary topic names and group names
The test coverage is thorough — valid V2 retry topics, malformed inputs (multiple +, empty group/topic), and negative cases (ordinary topics with +) are all covered.
LGTM. 👍
Automated review by github-manager-bot
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #11165 +/- ##
=============================================
+ Coverage 49.39% 49.41% +0.01%
- Complexity 14237 14267 +30
=============================================
Files 1390 1390
Lines 103123 103144 +21
Branches 13484 13490 +6
=============================================
+ Hits 50940 50967 +27
+ Misses 46031 45996 -35
- Partials 6152 6181 +29 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What is the purpose of the change
Fixes #11158.
KeyBuilder.buildPopRetryTopicV2()generates V2 pop retry topics using+as the separator between the consumer group and topic (POP_RETRY_SEPARATOR_V2), producing names like%RETRY%<cid>+<topic>. HoweverTopicValidator.VALID_CHAR_BIT_MAPdid not include+, so brokers withenableRetryTopicV2=truerejected these generated topics with "contains illegal characters".Brief changelog
+toTopicValidator.VALID_CHAR_BIT_MAP.^[%|a-zA-Z0-9_-]+$to^[%|a-zA-Z0-9_+-]+$.%RETRY%GID_test+normal_topicis valid.Verifying this change
mvn -f common/pom.xml test -Dtest=TopicValidatorTest— all 10 tests pass.