You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/04/30 07:22:59 UTC

[GitHub] [shardingsphere] sandynz opened a new issue, #17229: PipelineTableMetaDataLoader.getTableMetaData is not case-insensitive for table name

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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master branch
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   Proxy
   
   ### Expected behavior
   PipelineTableMetaDataLoader.getTableMetaData should case-insensitive for table name.
   
   ### Actual behavior
   Case-sensitive.
   
   Proxy log:
   ```
   [INFO ] 2022-04-30 14:50:08.688 [0130317c30317c3054317c7363616c696e675f6462_Worker-1] o.a.s.d.p.c.m.l.PipelineTableMetaDataLoader - loadTableMetaData, tableNamePattern=t_order, result={T_ORDER=PipelineTableMetaData(name=T_ORDER, columnMetaDataMap={order_id=PipelineColumnMetaData(ordinalPosition=1, name=order_id, dataType=4, dataTypeName=INT, primaryKey=true), user_id=PipelineColumnMetaData(ordinalPosition=2, name=user_id, dataType=4, dataTypeName=INT, primaryKey=false), status=PipelineColumnMetaData(ordinalPosition=3, name=status, dataType=12, dataTypeName=VARCHAR, primaryKey=false)}, columnNames=[order_id, user_id, status], primaryKeyColumns=[order_id])}, cost time=17 ms
   [WARN ] 2022-04-30 14:50:24.892 [0130317c30317c3054317c7363616c696e675f6462_Worker-1] o.a.s.d.p.c.m.l.PipelineTableMetaDataLoader - getTableMetaData, can not load metadata for table 't_order'
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   Run in MySQL (in MySQL cli):
   ```
   mysql> drop database if exists scaling_ds_0;
   Query OK, 4 rows affected (0.06 sec)
   
   mysql> create database scaling_ds_0 default charset utf8;
   Query OK, 1 row affected (0.03 sec)
   
   mysql> use scaling_ds_0
   Database changed
   mysql> CREATE TABLE T_ORDER (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
   Query OK, 0 rows affected (0.05 sec)
   
   mysql> insert into t_order (order_id, user_id, status) values (1,2,'ok'),(2,4,'ok'),(3,6,'ok'),(4,1,'ok'),(5,3,'ok'),(6,5,'ok');
   Query OK, 6 rows affected (0.03 sec)
   Records: 6  Duplicates: 0  Warnings: 0
   
   mysql> select * from T_ORDER;
   +----------+---------+--------+
   | order_id | user_id | status |
   +----------+---------+--------+
   |        1 |       2 | ok     |
   |        2 |       4 | ok     |
   |        3 |       6 | ok     |
   |        4 |       1 | ok     |
   |        5 |       3 | ok     |
   |        6 |       5 | ok     |
   +----------+---------+--------+
   6 rows in set (0.00 sec)
   ```
   
   Run in Proxy (in MySQL cli):
   ```
   mysql> create database scaling_db;
   Query OK, 0 rows affected (0.13 sec)
   
   mysql> use scaling_db
   Database changed
   mysql> ADD RESOURCE ds_0 (
       ->     URL="jdbc:mysql://127.0.0.1:3306/scaling_ds_0?serverTimezone=UTC&useSSL=false",
       ->     USER=root,
       ->     PASSWORD=root,
       ->     PROPERTIES("maximumPoolSize"=50,"idleTimeout"="60000")
       -> );
   Query OK, 0 rows affected (1.01 sec)
   
   mysql> CREATE SHARDING ALGORITHM database_inline (
       -> TYPE(NAME=INLINE,PROPERTIES("algorithm-expression"="ds_0"))
       -> );
   Query OK, 0 rows affected (1.73 sec)
   
   mysql> CREATE SHARDING ALGORITHM t_order_inline (
       -> TYPE(NAME=INLINE,PROPERTIES("algorithm-expression"="t_order"))
       -> );
   Query OK, 0 rows affected (0.06 sec)
   
   mysql> CREATE SHARDING TABLE RULE t_order (
       -> DATANODES("ds_0.t_order"),
       -> DATABASE_STRATEGY(TYPE=standard,SHARDING_COLUMN=user_id,SHARDING_ALGORITHM=database_inline),
       -> TABLE_STRATEGY(TYPE=standard,SHARDING_COLUMN=order_id,SHARDING_ALGORITHM=t_order_inline),
       -> KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME=snowflake))
       -> );
   Query OK, 0 rows affected (1.36 sec)
   
   mysql> preview select count(1) from t_order;
   +------------------+------------------------------+
   | data_source_name | actual_sql                   |
   +------------------+------------------------------+
   | ds_0             | select count(1) from t_order |
   +------------------+------------------------------+
   1 row in set (0.29 sec)
   
   mysql> select count(1) from t_order;
   +----------+
   | count(1) |
   +----------+
   |        6 |
   +----------+
   1 row in set (0.15 sec)
   
   mysql> CREATE SHARDING SCALING RULE scaling_auto1 (
       -> COMPLETION_DETECTOR(TYPE(NAME=IDLE, PROPERTIES("incremental-task-idle-second-threshold"=10))),
       -> DATA_CONSISTENCY_CHECKER(TYPE(NAME=DATA_MATCH, PROPERTIES("chunk-size"=1000)))
       -> );
   Query OK, 0 rows affected (0.09 sec)
   
   mysql> ADD RESOURCE ds_2 (
       ->     URL="jdbc:mysql://127.0.0.1:3306/scaling_ds_10?serverTimezone=UTC&useSSL=false",
       ->     USER=root,
       ->     PASSWORD=root,
       ->     PROPERTIES("maximumPoolSize"=50,"idleTimeout"="60000")
       -> ), ds_3 (
       ->     URL="jdbc:mysql://127.0.0.1:3306/scaling_ds_11?serverTimezone=UTC&useSSL=false",
       ->     USER=root,
       ->     PASSWORD=root,
       ->     PROPERTIES("maximumPoolSize"=50,"idleTimeout"="60000")
       -> ), ds_4 (
       ->     URL="jdbc:mysql://127.0.0.1:3306/scaling_ds_12?serverTimezone=UTC&useSSL=false",
       ->     USER=root,
       ->     PASSWORD=root,
       ->     PROPERTIES("maximumPoolSize"=50,"idleTimeout"="60000")
       -> );
   Query OK, 0 rows affected (0.21 sec)
   
   mysql> ALTER SHARDING TABLE RULE t_order(
       -> RESOURCES(ds_2,ds_3,ds_4),
       -> SHARDING_COLUMN=order_id,
       -> TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=6)),
       -> KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME=snowflake))
       -> );
   Query OK, 0 rows affected (0.27 sec)
   
   mysql> show scaling list;
   +--------------------------------------------+---------+----------------------+--------+---------------------+-----------+
   | id                                         | tables  | sharding_total_count | active | create_time         | stop_time |
   +--------------------------------------------+---------+----------------------+--------+---------------------+-----------+
   | 0130317c30317c3054317c7363616c696e675f6462 | t_order | 1                    | true   | 2022-04-30 14:50:07 | NULL      |
   +--------------------------------------------+---------+----------------------+--------+---------------------+-----------+
   1 row in set (0.24 sec)
   ```
   
   Run in MySQL:
   ```
   mysql> update T_ORDER set status='ok1' where order_id=1;
   Query OK, 1 row affected (0.03 sec)
   Rows matched: 1  Changed: 1  Warnings: 0
   ```
   
   Run in Proxy:
   ```
   mysql> show scaling status 0130317c30317c3054317c7363616c696e675f6462;
   +------+-------------+-------------------+--------+-------------------------------+--------------------------+
   | item | data_source | status            | active | inventory_finished_percentage | incremental_idle_seconds |
   +------+-------------+-------------------+--------+-------------------------------+--------------------------+
   | 0    | ds_0        | PREPARING_FAILURE | true   | 0                             | 0                        |
   +------+-------------+-------------------+--------+-------------------------------+--------------------------+
   1 row in set (0.02 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] zjcnb closed issue #17229: PipelineTableMetaDataLoader.getTableMetaData is not case-insensitive for table name

Posted by GitBox <gi...@apache.org>.
zjcnb closed issue #17229: PipelineTableMetaDataLoader.getTableMetaData is not case-insensitive for table name
URL: https://github.com/apache/shardingsphere/issues/17229


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