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/11/10 06:59:15 UTC

[GitHub] [shardingsphere] Inphoo opened a new issue #13532: IllegalStateException: Insert statement does not support sharding table routing to multiple data nodes

Inphoo opened a new issue #13532:
URL: https://github.com/apache/shardingsphere/issues/13532


   **Version**: shardingsphere-jdbc-core-spring-boot-starter:5.0.0
   
   I encountered an error. When inserting a record .
   The following is the configuration information. I use ‘id’,'plat_code' columns as sharding-columns 
   ```
       rules:
         sharding:
           sharding-algorithms:
             order-database-inline:
               props:
                 algorithm-expression: ds$->{id % 1}
               type: INLINE
             order-table-inline:
               props:
                 algorithm-expression: demo_order_$->{plat_code}$->{id % 2}
               type: INLINE
           tables:
             demo_order:
               actual-data-nodes: ds0.demo_order_$->{['app','web']}$->{0..1}
               database-strategy:
                 standard:
                   sharding-algorithm-name: order-database-inline
                   sharding-column: id
               table-strategy:
                 complex:
                   sharding-algorithm-name: order-table-inline
                   sharding-columns: id, plat_code
   ```
   when insert a record
   ```
   ### Error updating database.  Cause: java.lang.IllegalStateException: Insert statement does not support sharding table routing to multiple data nodes.
   ### The error may involve com.epean.trade.demo.dao.mapper.DemoOrderMapper.insertSelective-Inline
   ### The error occurred while setting parameters
   ### SQL: INSERT INTO demo_order  ( id,plat_code,order_time ) VALUES( ?,?,? )
   ### Cause: java.lang.IllegalStateException: Insert statement does not support sharding table routing to multiple data nodes.] with root cause
   
   java.lang.IllegalStateException: Insert statement does not support sharding table routing to multiple data nodes.
   	at com.google.common.base.Preconditions.checkState(Preconditions.java:508) ~[guava-30.0-jre.jar:na]
   	at org.apache.shardingsphere.sharding.route.engine.validator.dml.impl.ShardingInsertStatementValidator.postValidate(ShardingInsertStatementValidator.java:105) ~[shardingsphere-sharding-core-5.0.0.jar:5.0.0]
   	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.lambda$createRouteContext$1(ShardingSQLRouter.java:57) ~[shardingsphere-sharding-core-5.0.0.jar:5.0.0]
   	at java.util.Optional.ifPresent(Optional.java:159) ~[na:1.8.0_171]
   ```
   
   When I use single sharding column, there is no problem
   ```
   # this is ok
   rules:
         sharding:
           sharding-algorithms:
             order-database-inline:
               props:
                 algorithm-expression: ds$->{id % 1}
               type: INLINE
             order-table-inline:
               props:
                 algorithm-expression: demo_order_->{id % 2}
               type: INLINE
           tables:
             demo_order:
               actual-data-nodes: ds0.demo_order_$->{0..1}
               database-strategy:
                 standard:
                   sharding-algorithm-name: order-database-inline
                   sharding-column: id
               table-strategy:
                 standard:
                   sharding-algorithm-name: order-table-inline
                   sharding-column: id
   ```
   


-- 
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] longandy commented on issue #13532: IllegalStateException: Insert statement does not support sharding table routing to multiple data nodes

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


   赞


-- 
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] Inphoo closed issue #13532: IllegalStateException: Insert statement does not support sharding table routing to multiple data nodes

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


   


-- 
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] Inphoo commented on issue #13532: IllegalStateException: Insert statement does not support sharding table routing to multiple data nodes

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


   Find the reason,when complex, COMPLEX_INLINE instead of INLINE


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