You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "strongduanmu (via GitHub)" <gi...@apache.org> on 2023/04/03 09:49:18 UTC

[GitHub] [shardingsphere] strongduanmu opened a new issue, #24982: Can not show logic tables when I config same actual table name in different storage unit

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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   [c20da72](https://github.com/apache/shardingsphere/commit/c20da72e9ecbe8302b7fcc0eb1a60dead97e4854)
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Show all logic tables when I config same actual table name in different storage unit
   
   ### Actual behavior
   
   Just show the first logic table now.
   
   ```
   mysql> show tables like 't_order0';
   +-----------------------+------------+
   | Tables_in_sharding_db | Table_type |
   +-----------------------+------------+
   | t_order0              | BASE TABLE |
   +-----------------------+------------+
   1 row in set (0.00 sec)
   ```
   
   ### Reason analyze (If you can)
   
   Then ShardingRule#findTableRuleByActualTable method just consider actual table now. When I config same actual table name in different storage unit, and establish different mapping relationships for actual tables, the logic will be wrong.
   
   ![5hQgg2IQd9](https://user-images.githubusercontent.com/10829171/229473384-eab646ac-8b4d-4003-aac0-8ad3c4f77487.jpg)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ```yaml
   databaseName: sharding_db
   
   dataSources:
     ds_0:
       url: jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     ds_1:
       url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
   - !SHARDING
     tables:
       t_order0:
         actualDataNodes: ds_0.t_order
       t_order1:
         actualDataNodes: ds_1.t_order
     defaultDatabaseStrategy:
       none:
     defaultTableStrategy:
       none:
   ```
   
   And then execute following sqls:
   
   ```sql
   -- execute in ds_0 and ds_1
   CREATE TABLE `t_order` (
     `order_id` bigint(20) NOT NULL,
     `user_id` int(11) NOT NULL,
     `status` varchar(50) NOT NULL,
     `merchant_id` int(11) NOT NULL,
     `remark` varchar(50) NOT NULL,
     `creation_date` date NOT NULL,
     PRIMARY KEY (`order_id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
   
   mysql> show tables like 't_order0';
   +-----------------------+------------+
   | Tables_in_sharding_db | Table_type |
   +-----------------------+------------+
   | t_order0              | BASE TABLE |
   +-----------------------+------------+
   1 row in set (0.00 sec)
   
   mysql> show tables like 't_order1';
   Empty set (0.00 sec)
   ```
   
   ### 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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on issue #24982: Can not show logic tables when I config same actual table name in different storage unit

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #24982:
URL: https://github.com/apache/shardingsphere/issues/24982#issuecomment-1494020944

   Other call `findTableRuleByActualTable` scene also need to consider this problems.
   
   * LogicTablesMergedResult
   * ShowIndexMergedResult
   * ShowTableStatusMergedResult
   * PgClassTableCollector
   * DatabaseMetaDataResultSet
   * ShardingSphereResultSetMetaData
   * MySQLQueryHeaderBuilder
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org