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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master 65ca96a7c66e49d242edf5249800a497fef1cd86
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   After creating the shadow rule, users can load single table normally.
   
   ### Actual behavior
   <img width="968" alt="image" 
src="https://github.com/user-attachments/assets/0c4f20cb-f89a-4c81-993f-7f745e9ecd47";>
   
   ### Reason analyze (If you can)
   After creating the shadow rule, the previously independent storage unit no 
longer exists, and the single table cannot find the corresponding data source
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   ```sql
   mysql> create database shadow_db;
   Query OK, 0 rows affected (0.07 sec)
   
   mysql> USE shadow_db;
   Database changed
   mysql> REGISTER STORAGE UNIT product_ds (
       ->     
URL="jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
       ->     USER="root",
       ->     PASSWORD="123456",
       ->     PROPERTIES("maximumPoolSize"=10)
       -> ), shadow_ds (
       ->     
URL="jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true",
       ->     USER="root",
       ->     PASSWORD="123456",
       ->     PROPERTIES("maximumPoolSize"=10)
       -> );
   Query OK, 0 rows affected (0.67 sec)
   
   mysql> show unloaded single tables;
   +------------+-------------------+
   | table_name | storage_unit_name |
   +------------+-------------------+
   | t_user_0   | product_ds        |
   | t_user     | product_ds        |
   | t_user_3   | shadow_ds         |
   | t_user_2   | product_ds        |
   | t_user_1   | shadow_ds         |
   +------------+-------------------+
   5 rows in set (0.29 sec)
   
   mysql> load single table *.*;
   Query OK, 0 rows affected (0.12 sec)
   
   mysql> show tables;
   +---------------------+
   | Tables_in_shadow_db |
   +---------------------+
   | t_user              |
   | t_user_0            |
   | t_user_1            |
   | t_user_2            |
   | t_user_3            |
   +---------------------+
   5 rows in set (0.06 sec)
   
   mysql> show single tables;
   +------------+-------------------+
   | table_name | storage_unit_name |
   +------------+-------------------+
   | t_user     | product_ds        |
   | t_user_0   | product_ds        |
   | t_user_1   | shadow_ds         |
   | t_user_2   | product_ds        |
   | t_user_3   | shadow_ds         |
   +------------+-------------------+
   5 rows in set (0.01 sec)
   
   mysql> CREATE SHADOW RULE shadow_group (
       ->     SOURCE=product_ds,
       ->     SHADOW=shadow_ds,
       ->     t_single (
       ->       TYPE(NAME=VALUE_MATCH, 
PROPERTIES("operation"="insert","column"="status","value"=1))
       ->     )
       -> );
   Query OK, 0 rows affected (0.11 sec)
   
   mysql> show storage units;
   
+------------+-------+-----------+------+-----------+---------------------------------+---------------------------+---------------------------+---------------+---------------+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | name       | type  | host      | port | db        | 
connection_timeout_milliseconds | idle_timeout_milliseconds | 
max_lifetime_milliseconds | max_pool_size | min_pool_size | read_only | 
other_attributes                                                                
                                                                                
                                                                                
                                                                                
  |
   
+------------+-------+-----------+------+-----------+---------------------------------+---------------------------+---------------------------+---------------+---------------+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | product_ds | MySQL | 127.0.0.1 | 3306 | demo_ds_0 | 30000                  
         | 60000                     | 2100000                   | 10           
 | 1             | false     | 
{"healthCheckProperties":{},"initializationFailTimeout":1,"validationTimeout":5000,"keepaliveTime":0,"leakDetectionThreshold":0,"registerMbeans":false,"allowPoolSuspension":false,"autoCommit":true,"isolateInternalQueries":false,"queryProperties":{"allowPublicKeyRetrieval":"true","serverTimezone":"UTC","useSSL":"false"}}
 |
   | shadow_ds  | MySQL | 127.0.0.1 | 3306 | demo_ds_1 | 30000                  
         | 60000                     | 2100000                   | 10           
 | 1             | false     | 
{"healthCheckProperties":{},"initializationFailTimeout":1,"validationTimeout":5000,"keepaliveTime":0,"leakDetectionThreshold":0,"registerMbeans":false,"allowPoolSuspension":false,"autoCommit":true,"isolateInternalQueries":false,"queryProperties":{"allowPublicKeyRetrieval":"true","serverTimezone":"UTC","useSSL":"false"}}
 |
   
+------------+-------+-----------+------+-----------+---------------------------------+---------------------------+---------------------------+---------------+---------------+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   2 rows in set (0.32 sec)
   
   mysql> show tables;
   Empty set (0.00 sec)
   
   mysql> show single tables;
   Empty set (0.01 sec)
   
   mysql> show unloaded single tables;
   +------------+-------------------+
   | table_name | storage_unit_name |
   +------------+-------------------+
   | t_user_0   | shadow_group      |
   | t_user     | shadow_group      |
   | t_user_2   | shadow_group      |
   +------------+-------------------+
   3 rows in set (0.02 sec)
   
   mysql> load single table *.*;
   ERROR 10500 (44000): Invalid single rule configuration, reason is: Data 
source `product_ds` does not exist in database `shadow_db`.
   ```
   


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