[fix][broker] Fix topic policies cannot be queried with extensible load manager#23326
Merged
lhotari merged 2 commits intoSep 20, 2024
Merged
Conversation
BewareMyPower
requested review from
Demogorgon314,
codelipenghui,
heesung-sohn and
lhotari
September 20, 2024 06:52
heesung-sohn
approved these changes
Sep 20, 2024
lhotari
approved these changes
Sep 20, 2024
Demogorgon314
approved these changes
Sep 20, 2024
BewareMyPower
marked this pull request as draft
September 20, 2024 07:43
Contributor
Author
|
|
BewareMyPower
marked this pull request as ready for review
September 20, 2024 09:04
Contributor
Author
|
I skipped |
BewareMyPower
force-pushed
the
bewaremypower/fix-extensible-lm-tests
branch
from
September 20, 2024 09:10
1231dc1 to
b601f85
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #23326 +/- ##
============================================
+ Coverage 73.57% 74.65% +1.08%
- Complexity 32624 34409 +1785
============================================
Files 1877 1929 +52
Lines 139502 145158 +5656
Branches 15299 15884 +585
============================================
+ Hits 102638 108374 +5736
+ Misses 28908 28530 -378
- Partials 7956 8254 +298
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Motivation
#23319 brings a regression that topic policies cannot be queried with extensible load manager.
compactionScheduleTestcould not succeed now.In
SystemTopicBasedTopicPoliciesService#getTopicPoliciesAsync, it skips getting events from__change_eventsbecause the reader will fail to create if the load manager does not start.pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
Lines 253 to 259 in 4b3b273
However, the state validation in
ServiceUnitStateChannelImplhere is wrong:pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java
Line 270 in 4b3b273
The method above returns true when the state is
Closed,ConstructedorLeaderElectionServiceStarted, which is the opposite of the expected result (Started).Modifications
Fix the
ServiceUnitStateChannelImpl#started()method with the correct state validation.However, if only with this simple fix, the extensible load manager would fail to start. It's because after the table view creation for
loadbalancer-broker-load-dataandloadbalancer-top-bundles-load-datatopics happen after the load manager start. InisAllowAutoSubscriptionCreationAsync, it will wait until the future ofgetTopicPoliciesAsyncon these topics is done, while the reader creation on__change_eventswill fail.Therefore, to fix this start failure, just return true for internal topics in
isAllowAutoSubscriptionCreationAsync.Verifying this change
ExtensibleLoadManagerImplTest#compactionScheduleTestwill pass now. (It's in the flaky test suite)Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: