[BUG]fix zkBookieRackAffinityMapping bug to support for bookkeeper dnsResolver #9894
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
When using Region/Rack aware placement policy for pulsar managed ledger, we should also use those policy for bookkeeper and bookkeeper.conf should add the follow configuration. Otherwise, it the placement policy won't work for bookkeeper auto recovery.
However, if we configured change root for Zookeeper in bookkeeper.conf, eg.
/test-v1
is the change root for zookeeper.The
zkBookieRackAffinityMapping
resolver will be invalid, and all resolved result will benull
.The reason is that
zkBookieRackAffinityMapping
initiate Zookeeper Client according tozkServers
configured inbookkeeper.conf
, and doesn't take change root into account. Thus it lead to get bookies placement policy from wrong place , which is/bookies
and not the correct/test-v1/bookies
.Changes
bookkeeper.conf
before initiate Zookeeper Client. If it configured, use the change root path to initiate Zookeeper Client.