-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[fix][test] fix Flaky-test: ExtensibleLoadManagerImplTest.testLoadBalancerServiceUnitTableViewSyncer #24371
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
…ancerServiceUnitTableViewSyncer
@berg223 Please add the following content to your PR description and select a checkbox:
|
/pulsarbot rerun-failure-checks |
/pulsarbot run-failure-checks |
@berg223 Not really any concerns, but I just haven't had a chance to review yet. Regarding testing PRs, you should setup "Personal CI" to be able to run CI on your own while you are working on the PR. It's about enabling GitHub Actions in your own fork and opening a second PR in your own fork for the same PR branch to be able to run tests without approvals. |
protected static Pair<LookupService, LookupService> spyLookupService(PulsarClient client) | ||
throws IllegalAccessException { |
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.
It looks like there are unnecessary formatting changes. In Pulsar, we use the line width of 120. Please ensure that you have the code style setup in the way described in https://pulsar.apache.org/contribute/setup-ide/. Most contributors use IntelliJ.
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.
It looks like there are unnecessary formatting changes. In Pulsar, we use the line width of 120. Please ensure that you have the code style setup in the way described in https://pulsar.apache.org/contribute/setup-ide/. Most contributors use IntelliJ.
I have the code style setup before fomatting according to the doc you point out. Actually, the line has 121 characters. So it should be formatted! Let's skip the formmatting changes!
...test/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImplTest.java
Show resolved
Hide resolved
Optional<BrokerLookupData> brokerLookupData = | ||
primaryLoadManager.assign(Optional.empty(), bundle, LookupOptions.builder().build()).get(); |
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.
these look unnecessary again, perhaps due to different line length in your IDE code style
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.
these look unnecessary again, perhaps due to different line length in your IDE code style
This line has 137 characters. So the formmatting is reasonable!
@berg223 Regarding some other ExtensibleLoadManagerImpl related tests (in ExtensibleLoadManagerImplTest and in ServiceUnitStateChannelTest), one detail is about inconsistencies in how the test code changes the primary/leader by closing LeaderElectionImpl. LeaderElectionImpl should stop election operations after it's closed, but making that change will break tests. The draft change is #23995. I was planning to handle to problem by introducing an internal control interface for LeaderElection
tests could use this instead of using hacks which they currently rely on. Releasing leadership could be useful also in production code later if there would be a need to let go of the leadership role on one broker. However, this would be initially targeted for tests and not exposed. |
Thanks for detail instructments. It's very valueful for me! |
We are spying the case that our broker cannot connect to metadata store and the leadership hasn't change. The expected behavior should be that the loadbalanceManager of leader will reassign the bundles to other broker. So we won't use However, we can consider the clear and resuseable way to spy this case similiar to |
@lhotari I have setup the Personal CI. And all CI succeed except Upload Coverage (pull_request) . Is it okay to begin the testing after this PR reviewed? |
Fixes #24357
Main Issue: #24357
Motivation
The unit test failed because
loadManager4.getBrokerRegistry().unregister();
is not enough to ensure a successful unregister. The root cause is that broker will register it self after unregister. This happens in two place:ExtensibleLoadManagerImpl
, it will periodically register self.handleMetadataStoreNotification
and try to register itself again.Modifications
The modifications contains three part:
testLoadBalancerServiceUnitTableViewSyncer
. The syncer is not started and it maybe cause exception sometime. So I changed it to:Verifying this change
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: