[fix][bookie] Correctly handle list configuration values - #17661
Merged
michaeljmarshall merged 2 commits intoOct 11, 2022
Merged
Conversation
michaeljmarshall
requested review from
eolivelli,
gaozhangmin,
lhotari,
liudezhi2098 and
murong00
September 15, 2022 04:36
Member
Author
|
@lhotari @eolivelli - PTAL, thanks! |
michaeljmarshall
deleted the
fix-comma-delimited-list-for-rack-awareness
branch
October 11, 2022 20:19
michaeljmarshall
added a commit
that referenced
this pull request
Oct 11, 2022
* [fix][bookie] Correctly handle list configuration values * Remove unused import ### Motivation When the `metadataServiceUri` or the `zkServers` configuration for `BookieRackAffinityMapping` is provided as a comma delimited list, it is automatically parsed into an ArrayList by the configuration class because the Bookkeeper configuration class relies on the defaults in the `org.apache.commons.configuration.AbstractConfiguration` class. Here is a sample error: ``` 2022-07-29T19:25:43,437+0000 [main] ERROR org.apache.bookkeeper.client.RackawareEnsemblePlacementPolicyImpl - Failed to initialize DNS Resolver org.apache.pulsar.zookeeper.ZkBookieRackAffinityMapping, used default subnet resolver java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader 'bootstrap') ``` Also, see #6349 and #6343 for context. ### Modifications * Move the `castToString` method out to a shared class. * Use the `castToString` method to safely get the configuration value. ### Verifying this change This PR includes a test. ### Documentation - [x] `doc-not-needed` (cherry picked from commit 69deb1f)
michaeljmarshall
added a commit
that referenced
this pull request
Oct 11, 2022
* [fix][bookie] Correctly handle list configuration values * Remove unused import ### Motivation When the `metadataServiceUri` or the `zkServers` configuration for `BookieRackAffinityMapping` is provided as a comma delimited list, it is automatically parsed into an ArrayList by the configuration class because the Bookkeeper configuration class relies on the defaults in the `org.apache.commons.configuration.AbstractConfiguration` class. Here is a sample error: ``` 2022-07-29T19:25:43,437+0000 [main] ERROR org.apache.bookkeeper.client.RackawareEnsemblePlacementPolicyImpl - Failed to initialize DNS Resolver org.apache.pulsar.zookeeper.ZkBookieRackAffinityMapping, used default subnet resolver java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader 'bootstrap') ``` Also, see #6349 and #6343 for context. ### Modifications * Move the `castToString` method out to a shared class. * Use the `castToString` method to safely get the configuration value. ### Verifying this change This PR includes a test. ### Documentation - [x] `doc-not-needed` (cherry picked from commit 69deb1f)
nicoloboschi
pushed a commit
to datastax/pulsar
that referenced
this pull request
Oct 12, 2022
* [fix][bookie] Correctly handle list configuration values * Remove unused import ### Motivation When the `metadataServiceUri` or the `zkServers` configuration for `BookieRackAffinityMapping` is provided as a comma delimited list, it is automatically parsed into an ArrayList by the configuration class because the Bookkeeper configuration class relies on the defaults in the `org.apache.commons.configuration.AbstractConfiguration` class. Here is a sample error: ``` 2022-07-29T19:25:43,437+0000 [main] ERROR org.apache.bookkeeper.client.RackawareEnsemblePlacementPolicyImpl - Failed to initialize DNS Resolver org.apache.pulsar.zookeeper.ZkBookieRackAffinityMapping, used default subnet resolver java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader 'bootstrap') ``` Also, see apache#6349 and apache#6343 for context. ### Modifications * Move the `castToString` method out to a shared class. * Use the `castToString` method to safely get the configuration value. ### Verifying this change This PR includes a test. ### Documentation - [x] `doc-not-needed` (cherry picked from commit 69deb1f) (cherry picked from commit 9759815)
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
When the
metadataServiceUrior thezkServersconfiguration forBookieRackAffinityMappingis provided as a comma delimited list, it is automatically parsed into an ArrayList by the configuration class because the Bookkeeper configuration class relies on the defaults in theorg.apache.commons.configuration.AbstractConfigurationclass. Here is a sample error:Also, see #6349 and #6343 for context.
Modifications
castToStringmethod out to a shared class.castToStringmethod to safely get the configuration value.Verifying this change
This PR includes a test.
Documentation
doc-not-needed