TeslaCN opened a new issue #14796:
URL: https://github.com/apache/shardingsphere/issues/14796


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master - 1c844923a9f1da68f8d06934e3ee325f06717bc3
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   I think it's better to forbid configuring multiple DataSources under empty 
rule schema.
   
   ### Actual behavior
   
   ```
   mysql> use sharding_db;
   Database changed
   
   mysql> create table whereareyou (id bigint primary key, name varchar(100));
   Query OK, 0 rows affected (0.07 sec)
   
   mysql> show tables;
   +-----------------------+------------+
   | Tables_in_sharding_db | Table_type |
   +-----------------------+------------+
   | t_order_item_0        | BASE TABLE |
   | t_order_item_1        | BASE TABLE |
   | whereareyou           | BASE TABLE |
   +-----------------------+------------+
   3 rows in set (0.01 sec)
   
   mysql> insert into whereareyour (id,name) values (1, 'hi');
   ERROR 1146 (42S02): Table 'demo_ds_0.whereareyour' doesn't exist
   
   mysql> create table whereareyou (id bigint primary key, name varchar(100));
   ERROR 1050 (42S01): Table 'whereareyou' already exists
   
   mysql> insert into whereareyour (id,name) values (1, 'hi');
   ERROR 1146 (42S02): Table 'demo_ds_0.whereareyour' doesn't exist
   ```
   
   ### Reason analyze (If you can)
   
![image](https://user-images.githubusercontent.com/20503072/149612108-4e4d82d7-9c21-42bc-a23e-2f21b3f28eb1.png)
   
   DDL was routed to `ds_1` but the insert SQL was routed to `ds_0`.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ```yaml
   schemaName: sharding_db
   
   dataSources:
     ds_0:
       url: jdbc:mysql://127.0.0.1:3306/demo_ds_0
       username: root
       password: sudo reboot
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
     ds_1:
       url: jdbc:mysql://127.0.0.1:3306/demo_ds_1
       username: root
       password: sudo reboot
       connectionTimeoutMilliseconds: 3000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 32
       minPoolSize: 0
   ```
   
   


-- 
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