GuangGuo opened a new issue, #28408: URL: https://github.com/apache/shardingsphere/issues/28408
## 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? I've used two version of ShardingSphere, the one in dockerhub, newest, the other one is ghcr.io/apache/shardingsphere-proxy 9df5c119691ef645cc4c56db6ea2a4184e0eace2, also the newest in github. the mysql version, I've tried mysql 8.0.29 and mysql 8.1.0. ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-Proxy ### Expected behavior just readwrite splitting ### Actual behavior there is no table in given database. Before you use a database, you can execute `show tables`, and will give you the table name, in the sharding-proxy log you'll see `show tables` really executed in the mysql servers. But you can't `select` before you `use some database`, and after you `use a database`, and then you `show tables`, nothing found. It just disappears. And no sql have been executed. ### Reason analyze (If you can) ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. 1. a mysql cluster with a master and two slaves, work well. ` mysql> show tables; +------------------+ | Tables_in_myblog | +------------------+ | user | +------------------+ 1 row in set (0.00 sec) mysql> select * from user; +----+--------+-----+ | id | name | age | +----+--------+-----+ | 1 | zhang3 | 19 | | 2 | li4 | 20 | | 3 | wang5 | 21 | +----+--------+-----+ 3 rows in set (0.01 sec) ` 2. use sharding-proxy to readwrite splitting config_readwrite_splitting.yaml `databaseName: myblog_rs dataSources: write_ds: url: jdbc:mysql://172.31.194.254:3307/myblog?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false username: root password: 123456 connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 minPoolSize: 1 read_ds_0: url: jdbc:mysql://172.31.194.254:3308/myblog?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false username: root password: 123456 connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 minPoolSize: 1 read_ds_1: url: jdbc:mysql://172.31.194.254:3309/myblog?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false username: root password: 123456 connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 minPoolSize: 1 rules: - !READWRITE_SPLITTING dataSources: readwrite_ds: writeDataSourceName: write_ds readDataSourceNames: - read_ds_0 - read_ds_1 loadBalancerName: random loadBalancers: random: type: RANDOM` server.yaml `authority: users: - user: root@% password: 123456 - user: sharding password: sharding privilege: type: ALL_PERMITTED props: sql-show: true ` 3. docker start the sharding-proxy container `docker run -d --name sharding-proxy -v /home/shardingsphere-proxy/conf:/opt/shardingsphere-proxy/conf -v /home/shardingsphere-proxy/ext-lib:/opt/shardingsphere-proxy/ext-lib -p13307:3307 apache/shardingsphere-proxy:latest` `docker logs -f sharding-proxy we find java version: java17, full_version=17.0.8.1, full_path=/opt/java/openjdk/bin/java The classpath is /opt/shardingsphere-proxy/conf:/opt/shardingsphere-proxy/conf:.:/opt/shardingsphere-proxy/lib/*:/opt/shardingsphere-proxy/ext-lib/* main class org.apache.shardingsphere.proxy.Bootstrap -1 /opt/shardingsphere-proxy/conf 0.0.0.0 false [INFO ] 2023-09-11 07:56:43.826 [main] o.a.s.d.p.c.l.PipelineContextManagerLifecycleListener - mode type is not Cluster, mode type='Standalone', ignore [INFO ] 2023-09-11 07:56:43.849 [main] o.a.s.p.v.ShardingSphereProxyVersion - Database name is `MySQL`, version is `8.1.0`, database name is `myblog_rs` [INFO ] 2023-09-11 07:56:43.851 [main] o.a.s.p.frontend.ssl.ProxySSLContext - Proxy frontend SSL/TLS is not enabled. [INFO ] 2023-09-11 07:56:43.941 [main] o.a.s.p.frontend.ShardingSphereProxy - ShardingSphere-Proxy Standalone mode started successfully` 4. use mysql to login sharding-proxy `mysql -uroot -h IP address -P13307 -p` before everything, execute `show tables;`, you'll find the sql really executed in the mysql servers ` [INFO ] 2023-09-11 08:04:53.736 [ShardingSphere-Command-2] ShardingSphere-SQL - Logic SQL: show tables [INFO ] 2023-09-11 08:04:53.736 [ShardingSphere-Command-2] ShardingSphere-SQL - Actual SQL: write_ds ::: show tables [INFO ] 2023-09-11 08:04:53.736 [ShardingSphere-Command-2] ShardingSphere-SQL - Actual SQL: read_ds_0 ::: show tables [INFO ] 2023-09-11 08:04:53.736 [ShardingSphere-Command-2] ShardingSphere-SQL - Actual SQL: read_ds_1 ::: show tables ` and you will see the table ` mysql> show tables; +------------------+ | Tables_in_myblog | +------------------+ | user | +------------------+ ` and then you execute select, you got an error ` mysql> select * from myblog_rs.user; ERROR 10007 (42S02): Table or view `user` does not exist. ` then you `use myblog_rs`, and try to `select` ` mysql> select * from user; ERROR 10007 (42S02): Table or view `user` does not exist. ` 5. you still can see the database name, and when you execute `select 1`, and it really been executed by the mysql servers. ` mysql> show databases; +--------------------+ | schema_name | +--------------------+ | information_schema | | myblog_rs | | mysql | | performance_schema | | shardingsphere | | sys | +--------------------+ 6 rows in set (0.00 sec) ` mysql> use myblog_rs; Database changed mysql> show tables; Empty set (0.00 sec) mysql> select 1; +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.01 sec) ` the sharding-proxy logs ` [INFO ] 2023-09-11 08:30:04.220 [ShardingSphere-Command-5] ShardingSphere-SQL - Logic SQL: select 1 [INFO ] 2023-09-11 08:30:04.220 [ShardingSphere-Command-5] ShardingSphere-SQL - Actual SQL: read_ds_0 ::: select 1 ` so, readwrite splitting really works, but the table just disapper, I've no idea what happened. thx for you watching here. ### 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]
