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

[GitHub] [shardingsphere] zt9788 opened a new issue, #25095: JDBC datasource and table sharded by one column will route ERROR

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

   ### Which version of ShardingSphere did you use?
   5.3.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   Database DSS1 only has odd tables
   Database DSS0 only has even numbered tables
   ```
    demo_table:
         # Omitted
           actual-data-nodes: dss1.demotable1,demotable3,5 ...., dss0.demotable0,2,4,....
           database-strategy:
             standard:
               sharding-column: id
               sharding-algorithm-name: db-demo_table
           table-strategy:
             standard:
               sharding-column: id
               sharding-algorithm-name: table-demo_table
   
     db-demo_table:
         type: INLINE
         props:
           algorithm-expression: demotable_${id % 64}
       table-demo_table:
         type: INLINE
         props:
           algorithm-expression: dss${id % 2}
   ```
   When i use the SQL
   ```
   select * from demotable where id in(1,2,3,4)
   ```
   The sharding will throw the exception ,can not find demotable2 
   
   I think it's because ShadingJDBC first look for the indicated sub table route, then execute SQL, and then look for the sub database route
   


-- 
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] zt9788 commented on issue #25095: JDBC datasource and table sharded by one column will route ERROR

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

   > Your expression in `db-demo_table` is `demotable_${id % 64}`, maybe what you want is `demotable_${id % 2 % 64}`?
   
   
   No
   for example id = 100
   the will save the data in `DS0.demotable_36 ` 
   
   id = 101 `DS1.demotable_37` 
   
   It is `DS${id%2}.demotable_${id%64}`
   
   


-- 
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] RaigorJiang commented on issue #25095: JDBC datasource and table sharded by one column will route ERROR

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

   @zt9788 
   Your expression in `db-demo_table` is `demotable_${id % 64}`, maybe what you want is `demotable_${id % 2 % 64}`?


-- 
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 #25095: JDBC datasource and table sharded by one column will route ERROR

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

   @RaigorJiang Thank you for your remind, I will track this issue.


-- 
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] RaigorJiang commented on issue #25095: JDBC datasource and table sharded by one column will route ERROR

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

   Well, @strongduanmu  can you help to take a look?


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