[fix][broker] Avoid split non-existent bundle#25031
Conversation
|
@coderzc Please add the following content to your PR description and select a checkbox: |
e2b577f to
2da2096
Compare
2da2096 to
d582d6b
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #25031 +/- ##
============================================
+ Coverage 74.35% 74.47% +0.11%
+ Complexity 34102 34037 -65
============================================
Files 1920 1899 -21
Lines 150313 149641 -672
Branches 17459 17397 -62
============================================
- Hits 111771 111448 -323
+ Misses 29635 29320 -315
+ Partials 8907 8873 -34
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
f4ddc6f to
ef61623
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes a race condition where namespace bundles could be split multiple times, causing failures on subsequent split attempts after the bundle has already been removed. The fix adds validation to check if a bundle still exists in the current NamespaceBundles before attempting to split it.
Key Changes:
- Added validation logic to skip splitting bundles that no longer exist in NamespaceBundles
- Changed validateBundle exception signature from generic Exception to more specific IllegalArgumentException
- Added test case to verify repeated split attempts don't cause errors
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| ModularLoadManagerImpl.java | Added checkBundleDataExistInNamespaceBundles method to validate bundle existence before split; commented out lock statements in writeBrokerDataOnZooKeeper |
| NamespaceBundles.java | Changed validateBundle to throw IllegalArgumentException instead of generic Exception for better type safety |
| ModularLoadManagerImplTest.java | Added testRepeatSplitBundle test to verify the fix for repeated bundle split attempts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
(cherry picked from commit 38807b1)
(cherry picked from commit 38807b1)
Motivation
As you can see from the log, after
0x80000000_0xc0000000was successfully split, it was split again for the second time calling the updateAll() method and failed to split old bundle since bundle been deleted.Modifications
Skip split the bundles that do not exist in NamespaceBundles
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: