[ISSUE #9881] Increase broker notification timeout#10653
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
This PR increases the timeout for NOTIFY_MIN_BROKER_ID_CHANGE broker notification requests from 300ms to 3000ms, replacing a hardcoded magic number with a named constant NOTIFY_MIN_BROKER_ID_CHANGE_TIMEOUT_MILLIS. A new unit test verifies the timeout value via reflection.
Findings
-
[Info]
RouteInfoManager.java:71— The named constant improves readability and maintainability. The 10× increase (300ms → 3000ms) directly addresses issue #9881. -
[Info]
RouteInfoManager.java:935— ThenotifyMinBrokerIdChangedmethod iterates over brokers sequentially in a loop. With a 3000ms timeout per broker, worst-case blocking time isN × 3000mswhere N is the number of brokers to notify. For large clusters this could become noticeable. Consider whether async/parallel notification would be a future improvement — not a blocker for this PR. -
[Info]
RouteInfoManagerNewTest.java— The test uses reflection (setAccessible(true)) to invoke the privatenotifyMinBrokerIdChangedmethod. This is a common Java testing pattern but makes the test fragile to method signature changes. Consider making the method package-private if the team is comfortable with that.
Verdict
Clean, well-scoped change that correctly addresses the referenced issue. The code is straightforward, the constant extraction is good practice, and the test coverage is appropriate.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Extracts the hardcoded 300ms timeout for notifyMinBrokerIdChange into a named constant NOTIFY_MIN_BROKER_ID_CHANGE_TIMEOUT_MILLIS and increases it to 3000ms.
Findings
- [Warning]
RouteInfoManager.java:935— The timeout increase from 300ms to 3000ms (10x) is significant. While the intention is to prevent premature timeouts during broker notification, a 3-second blocking timeout in the NameServer's route info update path could slow down broker registration propagation under normal conditions. Consider:- Whether the root cause is network latency or broker-side processing delay
- If this should be configurable via
namesrvConfigrather than a static constant - Whether
invokeOnewayactually blocks for the full timeout or just sets a write timeout
- [Info]
RouteInfoManager.java:71— Good practice to extract magic numbers into named constants. The naming convention is consistent with the codebase. - [Info] Test coverage is added for the new timeout value.
Suggestions
Consider making the timeout configurable:
private final long notifyMinBrokerIdChangeTimeoutMillis =
namesrvController.getNamesrvConfig().getNotifyMinBrokerIdChangeTimeoutMillis();Verdict
The fix addresses a real issue (300ms being too aggressive), but the 3000ms value should ideally be configurable rather than hardcoded.
Automated review by github-manager-bot
7b991a2 to
0087ac9
Compare
|
Addressed the review feedback in
Local verification: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10653 +/- ##
=============================================
- Coverage 48.32% 48.24% -0.09%
+ Complexity 13490 13481 -9
=============================================
Files 1380 1380
Lines 101031 101096 +65
Branches 13092 13101 +9
=============================================
- Hits 48825 48769 -56
- Misses 46247 46345 +98
- Partials 5959 5982 +23 ☔ 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 (Re-review after new commit)
Summary
The author addressed the previous review suggestion: the timeout is now configurable via NamesrvConfig.getNotifyMinBrokerIdChangeTimeoutMillis() instead of being a hardcoded constant. Default value remains 3000ms.
Findings
- [Info]
NamesrvConfig.java— Clean addition ofnotifyMinBrokerIdChangeTimeoutMillisfield with getter/setter. Follows existing config patterns. - [Info]
RouteInfoManager.java:934— Now reads timeout from config:this.namesrvConfig.getNotifyMinBrokerIdChangeTimeoutMillis(). This is exactly the configurable approach suggested in the previous review. - [Info] Test verifies both the default (3000ms) and a custom value (1234ms), confirming configurability works correctly.
Verdict
The previous concern about hardcoding is fully resolved. The change is clean, well-tested, and backward-compatible (default 3000ms matches the previous intent). LGTM.
Automated re-review by github-manager-bot
Which Issue(s) This PR Fixes
Fixes #9881
Brief Description
Increase the timeout for
NOTIFY_MIN_BROKER_ID_CHANGEbroker notification requests from 300ms to 3000ms. This gives the NameServer broker notification path the timeout requested in the issue while keeping the change scoped to that notification.How Did You Test This Change?
mvn -pl namesrv -Dtest=RouteInfoManagerNewTest#notifyMinBrokerIdChangedUsesBrokerNotificationTimeout test -DfailIfNoTests=false -Djacoco.skip=true -Dspotbugs.skip=true -Dcheckstyle.skip=true -Drat.skip=truemvn -pl namesrv -Dtest=RouteInfoManagerNewTest test -DfailIfNoTests=false -Djacoco.skip=true -Dspotbugs.skip=true -Dcheckstyle.skip=true -Drat.skip=truegit diff --check