-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker] Avoid split non-existent bundle #25031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@coderzc Please add the following content to your PR description and select a checkbox: |
| } | ||
| } | ||
|
|
||
| writeBrokerDataOnZooKeeper(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wouldn't prevent race conditions. It seems that the method body of org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerImpl#updateAll method should be wrapped with synchronized (bundleSplitStrategy) { to prevent race conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually updating BrokerData will lead to severe lock contention. I checked again whether the bundle exists before the split the bundle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for the severe lock contention? How could it be "severe"?
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:
|
| return future; | ||
| } | ||
|
|
||
| public boolean checkBundleDataExistInNamespaceBundles(NamespaceBundles namespaceBundles, String bundleRange) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderzc What is the difference between the behavior here and org.apache.pulsar.common.naming.NamespaceBundles#validateBundle?
By the way, this should be a private method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior is almost the same, but validateBundle directly throws an exception instead of returning a result. I modified it to call validateBundle in checkBundleDataExistInNamespaceBundles.
f4ddc6f to
ef61623
Compare
| } | ||
| } finally { | ||
| lock.unlock(); | ||
| // lock.unlock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be modified. Small problem.
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: