Repository navigation
Conversation
…onfigurable - Add a broker setting with the existing 120-character default - Apply the configurable limit to broker-side group creation paths - Cover default, custom, fallback, cap, and batch behavior
RockteMQ-AI
left a comment
There was a problem hiding this comment.
LGTM. Clean implementation that adds broker-side configurability for subscription group max length while preserving backward compatibility.
Summary
- Added
subscriptionGroupMaxLengthtoBrokerConfig(default 120, capped at 255) - Introduced overloaded
TopicValidator.validateGroup(String, int)with defensive bounds checking - Updated 3 broker-side call sites (single create, batch create, auto-create) to use configured value
- Comprehensive test coverage (121 tests total across 3 test classes)
Design Notes
The implementation correctly preserves backward compatibility:
- Default value (120) matches the existing
GROUP_MAX_LENGTHconstant - Client-side and gRPC validation remain unchanged (still use hardcoded 120)
- Only broker-side operations are affected
The cap at 255 (RETRY_OR_DLQ_TOPIC_MAX_LENGTH) is appropriate because retry/DLQ topics are constructed as RETRY<group> and %DLQ%<group> (5 chars + group length). As noted in the PR description, groups exceeding 122 characters cannot use DLQ topics due to the 127-byte broker limit on topic names.
Minor Observation
The PR description mentions that callers must ensure retry topics stay within 255 characters when raising the limit, but the code doesn't enforce this automatically. This is a reasonable design choice (caller responsibility), but worth documenting in BrokerConfig Javadoc if not already present.
Test Coverage
- ✅ Boundary tests (0, negative, 255, >255 values)
- ✅ Integration tests (AdminBrokerProcessor, SubscriptionGroupManager)
- ✅ Validation logic tests (TopicValidator)
All tests pass on JDK 8 as reported. Ready to merge.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #11467 +/- ##
=============================================
+ Coverage 49.72% 49.74% +0.01%
- Complexity 14366 14376 +10
=============================================
Files 1390 1390
Lines 103264 103273 +9
Branches 13504 13505 +1
=============================================
+ Hits 51351 51376 +25
+ Misses 45707 45705 -2
+ Partials 6206 6192 -14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Adds subscriptionGroupMaxLength to BrokerConfig (default 120, capped at 255), making the broker-side subscription group name length configurable. All broker-side validation points (single create, batch create, auto-create) use the configured value, while client and gRPC validation remain unchanged for backward compatibility.
Findings
- [Info] The cap at 255 (
RETRY_OR_DLQ_TOPIC_MAX_LENGTH) is correct — it prevents users from configuring a value that would break retry/DLQ topic generation. The Javadoc clearly warns that groups over 122 characters cannot use%DLQ%<group>due to the 127-byte broker write limit. - [Info] The fallback logic in
validateGroup(group, maxLength)— non-positive values use the default, values above 255 are capped — is defensive and prevents misconfiguration. - [Info] Batch creation correctly rejects the entire batch if any group exceeds the limit (
testUpdateAndCreateSubscriptionGroupListRejectsWholeBatchWhenOneTooLong). This is the right behavior — partial creation would be confusing. - [Info] Test coverage is comprehensive: configurable length, cap at 255, fallback to default, blank/illegal validation, auto-create, single/batch creation. The tests verify both the validation result and the remark message content.
Suggestions
- Consider logging a warning at broker startup if
subscriptionGroupMaxLengthis set above 122, reminding operators that DLQ topics for groups in the range [123, 255] will fail. This makes the constraint visible in logs rather than only in documentation. - The
validateGroup(group, maxLength)overload shadows the local variablegroupMaxLengthwith the parameter. Consider renaming the parameter toconfiguredMaxLengthfor clarity, or usethis.groupMaxLengthto make the shadowing explicit.
Overall this is a solid enhancement with good defensive design and comprehensive testing.
Automated review by github-manager-bot
Which Issue(s) This PR Fixes
Brief Description
Adds
subscriptionGroupMaxLengthtoBrokerConfig, retaining the existing default of 120 and capping the effective limit at 255. Broker-side single, batch, and automatic group creation use the configured value, while client and gRPC validation remain unchanged.Callers that raise the limit must keep generated retry topics within 255 characters. Groups over 122 characters cannot use
%DLQ%<group>because broker writes reject topics over 127 bytes.How Did You Test This Change?
Ran
TopicValidatorTest,AdminBrokerProcessorTest, andSubscriptionGroupManagerTestwith JDK 8; all 121 tests passed.