peilinqian opened a new issue, #19137: URL: https://github.com/apache/shardingsphere/issues/19137
## 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? we find java version: java8, full_version=1.8.0_282 ShardingSphere-5.1.3-SNAPSHOT Commit ID: 7c67365b394d2e3ac562329b550c135c31ea764d Commit Message: Avoid overhead of invoking method in Optional.orElse (#18921) Branch: 7c67365b394d2e3ac562329b550c135c31ea764d Build time: 2022-07-08T19:24:17+0800 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-Proxy ### Expected behavior Create/alter traffic related distsql syntax are supported ### Actual behavior Create/alter traffic related distsql syntax are not supported ### Reason analyze (If you can) ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. CREATE TRAFFIC RULE sql_hint_traffic_2(LABELS(OLAP, order_by),TRAFFIC_ALGORITHM(TYPE(NAME= SQL_HINT))); ``` order_db=> CREATE TRAFFIC RULE sql_hint_traffic_2(LABELS(OLAP, order_by),TRAFFIC_ALGORITHM(TYPE(NAME= SQL_HINT))); ERROR: Traffic load balance algorithm can not be null. order_db=> order_db=> show traffic rules from traffic_db; ERROR: Rule `TrafficRule` should have and only have one instance. order_db=> CREATE TRAFFIC RULE sql_hint_traffic_2(LABELS(OLAP, order_by),TRAFFIC_ALGORITHM(TYPE(NAME= SQL_HINT)),LOAD_BALANCER(TYPE(NAME=ROUND_ROBIN))); ERROR: Rule `TrafficRule` should have and only have one instance. ``` ### Example codes for reproduce this issue (such as a github link). ``` [ERROR] 2022-07-14 14:40:11.226 [Connection-3-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: java.lang.IllegalStateException: Traffic load balance algorithm can not be null. at com.google.common.base.Preconditions.checkState(Preconditions.java:508) at org.apache.shardingsphere.traffic.rule.TrafficRule.getLoadBalancer(TrafficRule.java:176) at org.apache.shardingsphere.traffic.rule.TrafficRule.createTrafficStrategyRule(TrafficRule.java:109) at org.apache.shardingsphere.traffic.rule.TrafficRule.createTrafficStrategyRules(TrafficRule.java:92) at org.apache.shardingsphere.traffic.rule.TrafficRule.<init>(TrafficRule.java:67) at org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.updatable.CreateTrafficRuleHandler.replaceNewRule(CreateTrafficRuleHandler.java:95) at org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.updatable.CreateTrafficRuleHandler.update(CreateTrafficRuleHandler.java:53) at org.apache.shardingsphere.proxy.backend.text.distsql.ral.UpdatableRALBackendHandler.execute(UpdatableRALBackendHandler.java:38) at org.apache.shardingsphere.proxy.frontend.opengauss.command.query.simple.OpenGaussComQueryExecutor.execute(OpenGaussComQueryExecutor.java:76) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:108) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) [ERROR] 2022-07-14 14:40:27.788 [Connection-3-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: java.lang.IllegalStateException: Rule `TrafficRule` should have and only have one instance. at com.google.common.base.Preconditions.checkState(Preconditions.java:589) at org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData.getSingleRule(ShardingSphereRuleMetaData.java:91) at org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.queryable.ShowTrafficRulesHandler.getRows(ShowTrafficRulesHandler.java:62) at org.apache.shardingsphere.proxy.backend.text.distsql.ral.QueryableRALBackendHandler.createMergedResult(QueryableRALBackendHandler.java:62) at org.apache.shardingsphere.proxy.backend.text.distsql.ral.QueryableRALBackendHandler.execute(QueryableRALBackendHandler.java:53) at org.apache.shardingsphere.proxy.frontend.opengauss.command.query.simple.OpenGaussComQueryExecutor.execute(OpenGaussComQueryExecutor.java:76) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:108) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) ``` -- 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]
