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 2021/08/03 12:39:11 UTC

[GitHub] [shardingsphere] chengh1 opened a new issue #11623: Insert statements with expressions should not be routed to all datanodes

chengh1 opened a new issue #11623:
URL: https://github.com/apache/shardingsphere/issues/11623


   ## 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?
   5.0.0-RC1-SNAPSHOT
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   ### Expected behavior
   When inserting statement with expressions of a non-broadcast table, an exception should be thrown to avoid routing to all datanodes, which will cause dirty data problem.
   ### Actual behavior
   Insert clause when sharding key with expression will routing to all dataNodes, cause dirty data problem.
   ### Reason analyze (If you can)
   ![image](https://user-images.githubusercontent.com/39934378/127857753-1e8c4198-b67e-4fe7-b64b-7c03ab026c44.png)
   When performing SQL parsing, sharding key with expression will be parsed as BinaryOperationExpression, but when generating sharding conditions, only parsing the three types of SimpleExpressionSegment, NowExpression, and NullExpression, other types will not be parsed, so the final ShardingCondition list is Empty, when routing based on shardingCondition list, will full routing.
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   1.order_id is sharding key.
   2.execute sql  : 
   INSERT INTO t_order (order_id, user_id, status) VALUES (1+1, 2, 'insert');
   3.it will route to all datanodes, every datanode will have a record.
   ### 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

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



[GitHub] [shardingsphere] chengh1 commented on issue #11623: Insert statements with expressions should not be routed to all datanodes

Posted by GitBox <gi...@apache.org>.
chengh1 commented on issue #11623:
URL: https://github.com/apache/shardingsphere/issues/11623#issuecomment-891814237


   I'd like to fix it.


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



[GitHub] [shardingsphere] strongduanmu closed issue #11623: Insert statements with expressions should not be routed to all datanodes

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #11623:
URL: https://github.com/apache/shardingsphere/issues/11623


   


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



[GitHub] [shardingsphere] chengh1 closed issue #11623: Insert statements with expressions should not be routed to all datanodes

Posted by GitBox <gi...@apache.org>.
chengh1 closed issue #11623:
URL: https://github.com/apache/shardingsphere/issues/11623


   


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



[GitHub] [shardingsphere] strongduanmu commented on issue #11623: Insert statements with expressions should not be routed to all datanodes

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #11623:
URL: https://github.com/apache/shardingsphere/issues/11623#issuecomment-891909730


   @chengh1 Thank you for your feedback, and you are welcome to submit a PR.


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



[GitHub] [shardingsphere] chengh1 commented on issue #11623: Insert statements with expressions should not be routed to all datanodes

Posted by GitBox <gi...@apache.org>.
chengh1 commented on issue #11623:
URL: https://github.com/apache/shardingsphere/issues/11623#issuecomment-895138257


   Due to my wrong operation, there are multiple commits, I will re-submit pr


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