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/18 06:42:23 UTC

[GitHub] [shardingsphere] strongduanmu opened a new issue, #25208: Sharding feature can not pass through null sharding condition to sharding algorithm

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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   [6295a07](https://github.com/apache/shardingsphere/commit/6295a0723b65d23a4e8e2123fd6623d2898744b2)
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   When I execute `INSERT INTO t_order(status, merchant_id, remark, creation_date) VALUES('NOT OK', 21, NOW());`, sharding feature can pass through null sharding condition to sharding algorithm, then I can handle null value to special datasource.
   
   ### Actual behavior
   
   ```sql
   mysql> INSERT INTO t_order(status, merchant_id, remark, creation_date) VALUES('NOT OK', 21, NOW());
   ERROR 20087 (44000): Please check your sharding conditions `ShardingConditions(conditions=[ShardingCondition(values=[], startIndex=0)], sqlStatementContext=org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext@7021ede5, rule=org.apache.shardingsphere.sharding.rule.ShardingRule@3e359b56, subqueryContainsShardingCondition=true)` to avoid same record in table `t_order` routing to multiple data nodes.
   mysql>
   ```
   
   ### Reason analyze (If you can)
   
   ### 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_order:
         actualDataNodes: ds_${0..1}.t_order_${0..1}
         tableStrategy:
           standard:
             shardingColumn: order_id
             shardingAlgorithmName: t_order_inline
       t_order_item:
         actualDataNodes: ds_${0..1}.t_order_item_${0..1}
         tableStrategy:
           standard:
             shardingColumn: order_id
             shardingAlgorithmName: t_order_item_inline
     bindingTables:
       - t_order,t_order_item
     defaultDatabaseStrategy:
       standard:
         shardingColumn: user_id
         shardingAlgorithmName: database_inline
     defaultTableStrategy:
       none:
   
     shardingAlgorithms:
       database_inline:
         type: INLINE
         props:
           algorithm-expression: ds_${user_id % 2}
       t_order_inline:
         type: INLINE
         props:
           algorithm-expression: t_order_${order_id % 2}
       t_order_item_inline:
         type: INLINE
         props:
           algorithm-expression: t_order_item_${order_id % 2}
   ```
   
   Then execute following sqls:
   
   ```sql
   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;
   
   INSERT INTO t_order(status, merchant_id, remark, creation_date) VALUES('NOT OK', 21, NOW());
   ```
   
   ### 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] sandynz closed issue #25208: Sharding feature can not pass through null sharding condition to sharding algorithm

Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz closed issue #25208: Sharding feature can not pass through null sharding condition to sharding algorithm
URL: https://github.com/apache/shardingsphere/issues/25208


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