You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[fix][bookie] Correctly handle list configuration values (#17661)
* [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`
Copy file name to clipboardexpand all lines: pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicy.java
Copy file name to clipboardexpand all lines: pulsar-broker-common/src/test/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMappingTest.java
+12
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,18 @@ public void testBasic() throws Exception {
0 commit comments