-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[fix][broker] Fix PulsarRegistrationClient and ZkRegistrationClient not aware rack info problem. #18672
[fix][broker] Fix PulsarRegistrationClient and ZkRegistrationClient not aware rack info problem. #18672
Conversation
@horizonzy Please add the following content to your PR description and select a checkbox:
|
Codecov Report
@@ Coverage Diff @@
## master #18672 +/- ##
=============================================
- Coverage 47.50% 36.31% -11.19%
- Complexity 10505 13890 +3385
=============================================
Files 698 1665 +967
Lines 67984 141229 +73245
Branches 7272 16809 +9537
=============================================
+ Hits 32297 51294 +18997
- Misses 32112 83994 +51882
- Partials 3575 5941 +2366
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@horizonzy Thanks for your contribution. We have changed the resolver and would you please help add a test to cover both two resolvers? |
Fine |
Great work, fix the #18834 |
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.
LGTM
btw, the else logic - String metadataServiceUri = ConfigurationStringUtil.castToString(conf.getProperty("metadataServiceUri"));
+ String metadataServiceUri = ConfigurationStringUtil.castToString(conf.getProperty("metadataStoreUrl")); Lines 79 to 108 in 82237d3
run autorecovery standlone : ./bin/pulsar autorecovery ###### bookkeeper client url config #####
metadataServiceUri=zk+hierarchical://10.206.128.154:2181;10.206.128.155:2181;10.206.128.156:2181;10.206.128.157:2181;10.206.128.158:2181/bk1
###### bookkeeper client rack config #####
ensemblePlacementPolicy=org.apache.bookkeeper.client.RackawareEnsemblePlacementPolicy
reppDnsResolverClass=org.apache.pulsar.bookie.rackawareness.BookieRackAffinityMapping
minNumRacksPerWriteQuorum=2
enforceMinNumRacksPerWriteQuorum=true
##### BookieRackAffinityMapping config #####
metadataStoreUrl=zk:10.206.128.154:2181,10.206.128.155:2181,10.206.128.156:2181,10.206.128.157:2181,10.206.128.158:2181/sf-pulsar-1
zkTimeout=3000 |
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.
Nice catch!
...r-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java
Show resolved
Hide resolved
@hangc0276 Do we need to cherry-pick to branch-2.9? I noticed you have added the label |
...r-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java
Show resolved
Hide resolved
...mmon/src/test/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMappingTest.java
Show resolved
Hide resolved
BookieAddressResolver bookieAddressResolver = getBookieAddressResolver(); | ||
if (bookieAddressResolver instanceof DefaultBookieAddressResolver) { | ||
try { | ||
Field field = DefaultBookieAddressResolver.class.getDeclaredField("registrationClient"); |
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.
Can you please send a PR to BookKeeper in order to make this field accessible with a getter?
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.
That's fine.
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.
Dose this pulsar pr wait for the next bk release?
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.
We can use reflection
@codelipenghui This Pr doesn't need to be cherry-picked to branch-2.9. I removed the label. |
…ot aware rack info problem. (#18672)
…ot aware rack info problem. (apache#18672) (cherry picked from commit 43335fb) (cherry picked from commit 003c186)
Fixes #18671
Master Issue: #18671
Before #16825, the method
getRack
will update the rack info every invoke, so it can get the newest rack info.After #16825, only Pulsar start or using pulsar admin set-bookie-rack to change zk node
/bookies
, then update the rack info. When the pulsar start, the PulsarRegistrationClient#bookieServiceInfoCache is empty; it can't resolve bookieId, so can't update the rack info.Motivation
Make Pulsar and AutoRecovery aware of the rack info after its restart.
Modifications
After writeable bookies change, notify BookieRackAffinityMapping to update the rack info.
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
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: