shardingsphere
shardingsphere copied to clipboard
Confusion about the positioning of ShardingRuleConfiguration
Question
For English only, other languages will not accept.
Before asking a question, make sure you have:
- Googled your question.
- 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 anymore and we cannot reproduce it on current information, we will close it
-
I took a look at https://shardingsphere.apache.org/document/5.2.0/en/dev-manual/configuration/ and got some confusion.
-
AlgorithmShardingRuleConfigurationisUsed to convert algorithm-based sharding user configuration into sharding rule objects,ShardingRuleConfigurationisUsed to convert sharding user configuration into sharding rule objects, is there any difference in semantics? -
I am a little surprised that the two classes are not in a parent-subclass relationship. Because I noticed that from ShardingSphere
5.1.2to5.2.0, most ofAlgorithmShardingRuleConfigurationwas replaced byShardingRuleConfiguration, which is reflected in the design oforg.apache.shardingsphere.mode.manager.ContextManager.
Hi @linghengqian, AlgorithmShardingRuleConfiguration should refer to AlgorithmProvidedShardingRuleConfiguration, the documentation should be wrong. It is mainly suitable for Spring scenarios, Spring will help us complete the initialization of algorithm objects, and ShardingRuleConfiguration is suitable for non-Spring environments.
I also find it confusing to have two similar classes, are you interested in trying to merge them?
@strongduanmu
-
I'm stumped because some of my local attempts are affected by the strange behavior of
org.apache.shardingsphere.mode.manager.ContextManager#alterRuleConfiguration. The strange behavior I'm referring to ends up being something like https://github.com/apache/shardingsphere/issues/20952. -
I'd like to have other friends to try the work of merge the two classes.
- I'm stumped because some of my local attempts are affected by the strange behavior of
org.apache.shardingsphere.mode.manager.ContextManager#alterRuleConfiguration. The strange behavior I'm referring to ends up being something like NPE " Cannot invoke "org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema.getVisibleColumnNames(String)" because the return value of "java.util.Map.get(Object)" is null" #20952.
@linghengqian This exception may be caused by wrong metadata, we will investigate it later.
- I will try to verify after https://github.com/apache/shardingsphere/pull/21037 is merged.
@strongduanmu
-
After https://github.com/apache/shardingsphere/pull/21037 was merged and I tested the master branch, the metadata issue with
org.apache.shardingsphere.mode.manager.ContextManager#alterRuleConfigurationwas resolved. -
From the results of my testing, https://github.com/apache/shardingsphere/issues/20952 has also been resolved.
-
Considering this issue is a question, should I close it immediately? Should merging two classes be a new issue?