Use spring-boot configures MasterSlave with RegistryCenter Zookeeper, the MasterSlave configuration on RegistryCenter is wrong
Bug Report
For English only, other languages will not accept.
Before report a bug, make sure you have:
- Searched open and closed GitHub issues.
- Read documentation: ShardingSphere Doc.
Please pay attention on issues you submitted, because we maybe need more details. If no response more than 7 days and we cannot reproduce it on current information, we will close it.
Please answer these questions before submitting your issue. Thanks!
Which version of ShardingSphere did you use?
4.0.0-rc3
Which project did you use? Sharding-JDBC or Sharding-Proxy?
sharding-jdbc
Expected behavior
yaml configuration format:
slaveDataSourceNames:
- slave_ds_0
- slave_ds_1
Actual behavior
masterDataSourceName: ds_master
name: ds_ms
slaveDataSourceNames: !!set
ds_slave_0: null
ds_slave_1: null
Reason analyze (If you can)
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Just run by using spring-boot to configure.
Example codes for reproduce this issue (such as a github link).
Spring use StringToCollectionConverter to handle this property. And the type slaveDataSourceNames in YamlMasterSlaveConfiguration is Collection, so spring use HashLinkedSet to save.
public static <E> Collection<E> createCollection(Class<?> collectionType, Class<?> elementType, int capacity) {
Assert.notNull(collectionType, "Collection type must not be null");
if (collectionType.isInterface()) {
if (Set.class != collectionType && Collection.class != collectionType) {
if (List.class == collectionType) {
return new ArrayList(capacity);
} else if (SortedSet.class != collectionType && NavigableSet.class != collectionType) {
throw new IllegalArgumentException("Unsupported Collection interface: " + collectionType.getName());
} else {
return new TreeSet();
}
} else {
return new LinkedHashSet(capacity);
}
...