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 2020/05/30 03:38:53 UTC
[GitHub] [shardingsphere] jacksparrow414 opened a new issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
jacksparrow414 opened a new issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855
## I write a sql that does not have sharding conditions, ShardingJdbc should full route ,but it doesn't work,it just route a part of tables in the datebases.
I read Docunment of ShardingSphere ,the Docunment show that **If SQL does not have sharding conditions, it is impossible to shard without full route**
ShardingJdbc version: **4.1.0**
MyShardingConfiguration file:
shardingsphere:
datasource:
# database alias
names: ds0,ds1,ds0-slave0,ds0-slave1
# masterOne
ds0:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/dhb?serverTimezone=UTC
password: 12345
username: root
# slaveOne of masterOne
ds0-slave0:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3307/dhb?serverTimezone=UTC
password: 12345
username: root
# slaveTwo of masterOne
ds0-slave1:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3308/dhb?serverTimezone=UTC
password: 12345
username: root
# masterTwo
ds1:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3310/dhb?serverTimezone=UTC
password: 12345
username: root
sharding:
default-database-strategy:
inline:
sharding-column: id
algorithm-expression: ds$->{id % 2}
default-table-strategy:
inline:
sharding-column: age
algorithm-expression: user_$->{age % 2}
tables:
user:
actual-data-nodes: ds$->{0..1}.user_$->{0..1}
default-data-source-name: ds0
master-slave-rules:
ds0:
master-data-source-name: ds0
slave-data-source-names: ds0-slave0,ds0-slave1
# ROUND_ROBIN,RANDOM。
load-balance-algorithm-type: ROUND_ROBIN
encrypt-rule:
encryptors:
encryptor_aes:
type: aes
props:
aes.key.value: 123456abc
tables:
user:
columns:
name:
cipherColumn: name
encryptor: encryptor_aes
props:
sql.show: true
check:
table:
metadata: true
enabled: true
query:
with:
cipher:
column: true
when I use **name** as query condition,it should full route:
1. ds1.user_0
2. ds1.user_1
3. ds0-slave0.user_0
4. ds0-slave0.user_1
5. ds0-slave1.user_0
6. ds0-slave1.user_1
I tested it 10+ times,but it always just route a part of tables in the slave databses:

If the situation is normal,then what are the rules for routing?
cloud someone help me with this question?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jacksparrow414 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
jacksparrow414 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636425696
> name is you shrding colum? can you show sql
it is beacuse that name is not sharding colum,ShardingSphere-Jdbc should full route.
SQL is:
```
select id,name,age from user;
```
you could See the screenshot above
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] kimmking commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636646864
Full route is for sharding, not for master-slave.
In sharding+master-slave cases, the same tables in different datasources are considered as a logic one when routing.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] yu199195 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636448908
@jacksparrow414 ok,we have received your question, and we will try to correct the function later. thanks.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jacksparrow414 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
jacksparrow414 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636783771
@kimmking OK,I see,thanks
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] yu199195 edited a comment on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
yu199195 edited a comment on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636440137
>I expect full route,but it doesn't full route.
when I config two slave databases,every database has two tables,user_0,user_1.
it just route a part of databases,it just route salve0.user_0,slave1.user_1.
why?
Shouldn't it will route slave0.user_0,slave0.user_1,salve1.user_0,salve1.user_1?
you colud see my configuration above
Master-slave queries only walk one slave.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jacksparrow414 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
jacksparrow414 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636450036
ok
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] yu199195 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636440137
Master-slave queries only walk one slave.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jacksparrow414 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
jacksparrow414 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636610421
@yu199195 sorry ,I still don't understand.I do sharding table,
but , I use **age** as sharding conditoins.
actually , I use name as query conditions
then shaedingsphere should full route,because this query no sharding conditions.
If the situation is normal,then what are the rules for routing when full oute?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] yu199195 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636431026
it will full route,what do you expect?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] yu199195 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636419955
name is you shrding colum?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] kimmking edited a comment on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636646864
Full routing is for sharding, not for master-slave.
In sharding+master-slave cases, the same tables in different datasources are considered as a logic one when routing.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jacksparrow414 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
jacksparrow414 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636437966
I expect full route,but it doesn't full route.
when I config two slave databases,every database has two tables,user_0,user_1.
it just route a part of databases,it just route salve0.user_0,slave1.user_1.
why?
Shouldn't it will route slave0.user_0,slave0.user_1,salve1.user_0,salve1.user_1?
you colud see my configuration above
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] kimmking closed issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
kimmking closed issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] yu199195 edited a comment on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
yu199195 edited a comment on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636419955
name is you shrding colum? can you show sql
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jacksparrow414 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
jacksparrow414 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636443492
> > I expect full route,but it doesn't full route.
> > when I config two slave databases,every database has two tables,user_0,user_1.
> > it just route a part of databases,it just route salve0.user_0,slave1.user_1.
> > why?
> > Shouldn't it will route slave0.user_0,slave0.user_1,salve1.user_0,salve1.user_1?
> > you colud see my configuration above
>
> Master-slave queries only walk one slave.
if only walk one slave,it should route two tables from the same salve,
slave0.user_0 and salve0.user_1
**Or**
slave1.user_0 and slave1.user_1
but,it routed two tables from slave0、slave1.
actually,it routed **slave0.user_0** and **slave1.user_1**
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] yu199195 commented on issue #5855: when I write a sql that doesn't have sharding conditions, full route doesn't work
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #5855:
URL: https://github.com/apache/shardingsphere/issues/5855#issuecomment-636601348
@jacksparrow414 hi,The routing result is correct, Because you also configure sharding,
ou want to get all the users , you also config sharding table with t_user,
so,the result is salve_0.t_user_0, slave_1_t_user_1。
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org