sandynz opened a new issue, #16331:
URL: https://github.com/apache/shardingsphere/issues/16331

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master branch, commit d71cac1c6d43eeda8906469ac504226416ceb14c
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   It works before, seems it's affected by PR #16172, I'm not sure whether it's 
bug or not.
   
   ### Actual behavior
   SQL:
   ```
   mysql> CREATE SHARDING BINDING TABLE RULES (bmsql_customer,bmsql_warehouse);
   ERROR 1117 (C1117): Invalid binding rule [bmsql_customer,bmsql_warehouse], 
error messages are: [Unable to bind different sharding strategies].
   ```
   
   Exception stack trace:
   ```
   
org.apache.shardingsphere.infra.distsql.exception.rule.InvalidRuleConfigurationException:
 Invalid binding rule [bmsql_customer,bmsql_warehouse], error messages are: 
[Unable to bind different sharding strategies].
        at 
org.apache.shardingsphere.sharding.distsql.handler.update.CreateShardingBindingTableRuleStatementUpdater.lambda$checkToBeCreatedBindableBindingTables$6(CreateShardingBindingTableRuleStatementUpdater.java:100)
        at 
org.apache.shardingsphere.infra.distsql.exception.DistSQLException.predictionThrow(DistSQLException.java:43)
        at 
org.apache.shardingsphere.sharding.distsql.handler.update.CreateShardingBindingTableRuleStatementUpdater.checkToBeCreatedBindableBindingTables(CreateShardingBindingTableRuleStatementUpdater.java:99)
        at 
org.apache.shardingsphere.sharding.distsql.handler.update.CreateShardingBindingTableRuleStatementUpdater.checkSQLStatement(CreateShardingBindingTableRuleStatementUpdater.java:59)
        at 
org.apache.shardingsphere.sharding.distsql.handler.update.CreateShardingBindingTableRuleStatementUpdater.checkSQLStatement(CreateShardingBindingTableRuleStatementUpdater.java:50)
        at 
org.apache.shardingsphere.proxy.backend.text.distsql.rdl.rule.RuleDefinitionBackendHandler.execute(RuleDefinitionBackendHandler.java:82)
        at 
org.apache.shardingsphere.proxy.backend.text.distsql.rdl.rule.RuleDefinitionBackendHandler.execute(RuleDefinitionBackendHandler.java:60)
        at 
org.apache.shardingsphere.proxy.backend.text.SchemaRequiredBackendHandler.execute(SchemaRequiredBackendHandler.java:51)
        at 
org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:67)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:96)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:69)
        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)
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   I'm testing BenchmarkSQL in Proxy, since there's join query, so I need to 
set binding tables. sql:
   ```
        stmtNewOrderSelectWhseCust = dbConn.prepareStatement(
                "SELECT c_discount, c_last, c_credit, w_tax " +
                "    FROM bmsql_customer " +
                "    JOIN bmsql_warehouse ON (w_id = c_w_id) " +
                "    WHERE c_w_id = ? AND c_d_id = ? AND c_id = ?");
   ```
   
   Execute following SQLs on MySQL client (connected to Proxy):
   ```
   create database scaling_bmsql2;
   
   use scaling_bmsql2
   
   ADD RESOURCE ds_0 (
       
URL="jdbc:mysql://127.0.0.1:3306/scaling_bmsql1?serverTimezone=UTC&useSSL=false",
       USER=root,
       PASSWORD=root,
       PROPERTIES("maximumPoolSize"=50,"idleTimeout"="60000")
   ), ds_1 (
       
URL="jdbc:mysql://127.0.0.1:3306/scaling_bmsql2?serverTimezone=UTC&useSSL=false",
       USER=root,
       PASSWORD=root,
       PROPERTIES("maximumPoolSize"=50,"idleTimeout"="60000")
   );
   
   CREATE SHARDING TABLE RULE bmsql_warehouse(
   RESOURCES(ds_0,ds_1),
   SHARDING_COLUMN=w_id,
   TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=2)),
   KEY_GENERATE_STRATEGY(COLUMN=w_id,TYPE(NAME=snowflake))
   ), bmsql_customer(
   RESOURCES(ds_0,ds_1),
   SHARDING_COLUMN=c_w_id,
   TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=2)),
   KEY_GENERATE_STRATEGY(COLUMN=c_w_id,TYPE(NAME=snowflake))
   );
   
   CREATE SHARDING BINDING TABLE RULES (bmsql_customer,bmsql_warehouse);
   ```
   
   ### 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]

Reply via email to