GuryYu opened a new issue, #33838: URL: https://github.com/apache/shardingsphere/issues/33838
## Bug Report **For English only**, other languages will not accept. Before report a bug, make sure you have: - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues). - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview). 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**. Please answer these questions before submitting your issue. Thanks! ### Which version of ShardingSphere did you use? 5.5.1 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-JDBC ### Expected behavior expected pass the validation and run normally. ### Actual behavior Error Info: ``` Algorithm 'Object.'INLINE' initialization failed, reason is: `sensitivityShardingAlgorithm` sharding algorithm configuration of `logic_base_visual_release` does not match the actual data nodes. ``` ### Reason analyze (If you can) In ```org.apache.shardingsphere.sharding.rule.ShardingTable``` class ```createDataSourceDataNode``` method. ``` private static final Pattern DATA_NODE_SUFFIX_PATTERN = Pattern.compile("\\d+$"); ... String prefix = DATA_NODE_SUFFIX_PATTERN.matcher(actualDataNodes.iterator().next().getDataSourceName()).replaceAll(""); ``` prefix val is ```ds_normal``` But in ```org.apache.shardingsphere.sharding.rule.checker.ShardingRuleChecker``` class ```validateInlineShardingAlgorithm``` method. check expression is ```null == result || result.startsWith(dataNodeInfo.getPrefix())``` result val is ```ds_sensitive```, not match prefix result, then throw exception. ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. The following configuration defines two data sources, named ds_normal and ds_sensitive. The sharding rules are defined using an enumerated value in a Groovy line expression. It works fine in version 5.3.2, but an error occurs when running in version 5.5.1. ``` dataSources: ds_normal: ... ds_sensitive: ... rules: - !SHARDING tables: logic_base_visual_release: actualDataNodes: "ds_$->{['normal', 'sensitive']}.base_visual_release" logic_base_visual_dev: actualDataNodes: "ds_$->{['normal', 'sensitive']}.base_visual_dev" defaultDatabaseStrategy: standard: shardingColumn: f_special_mark shardingAlgorithmName: sensitivityShardingAlgorithm shardingAlgorithms: sensitivityShardingAlgorithm: type: INLINE props: algorithm-expression: "ds_$->{f_special_mark == 0 ? 'normal' : 'sensitive'}" ``` ### Example codes for reproduce this issue (such as a github link). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
