[ISSUE #10931] Initialize cluster transaction address mapping - #10932
Open
Aias00 wants to merge 1 commit into
Open
[ISSUE #10931] Initialize cluster transaction address mapping#10932Aias00 wants to merge 1 commit into
Aias00 wants to merge 1 commit into
Conversation
Signed-off-by: liuhy <liuhongyu@apache.org>
RockteMQ-AI
approved these changes
Aug 15, 2026
RockteMQ-AI
left a comment
Contributor
There was a problem hiding this comment.
Summary
LGTM. This is a clean defensive fix that prevents NPE when accessing the broker address map before the first heartbeat scan.
Key change:
- Initialize
brokerAddrNameMapRefwithCollections.emptyMap()instead of null - Thread-safe immutable empty map is appropriate for
AtomicReference
Test coverage:
- New test
testAddTransactionDataByBrokerAddrBeforeFirstHeartbeatvalidates the edge case - Verifies that accessing the map before heartbeat scan returns null gracefully instead of throwing NPE
Minimal, focused fix with proper validation.
Automated review by github-manager-bot
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10932 +/- ##
=============================================
- Coverage 48.62% 48.52% -0.10%
+ Complexity 13692 13657 -35
=============================================
Files 1381 1381
Lines 101464 101465 +1
Branches 13187 13187
=============================================
- Hits 49337 49240 -97
- Misses 46142 46219 +77
- Partials 5985 6006 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Initialize the cluster transaction address-to-broker mapping with an empty map so a transaction sent before the first heartbeat scan does not dereference a null map.
Validation
mvn -pl proxy -Dtest=ClusterTransactionServiceTest testCloses #10931