You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "devin-wanghuixiong (via GitHub)" <gi...@apache.org> on 2023/08/24 08:16:22 UTC
[GitHub] [shardingsphere] devin-wanghuixiong opened a new issue, #28249: 进行表绑定BUG,版本5.4/5.3.2
devin-wanghuixiong opened a new issue, #28249:
URL: https://github.com/apache/shardingsphere/issues/28249
## Bug Report
规则:
CREATE SHARDING TABLE RULE t_order(
DATANODES("ds_0.t_order_${2023..2025}_0${1..9},ds_0.t_order_${2023..2025}_${10..12}"),
AUDIT_STRATEGY (TYPE(NAME='DML_SHARDING_CONDITIONS'),ALLOW_HINT_DISABLE=TRUE));
CREATE SHARDING TABLE RULE t_item (
DATANODES("ds_0.t_item_${2023..2025}_0${1..9},ds_0.t_item_${2023..2025}_${10..12}"),
KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME="snowflake")),
AUDIT_STRATEGY (TYPE(NAME="DML_SHARDING_CONDITIONS"),ALLOW_HINT_DISABLE=TRUE)
);
绑定:
CREATE SHARDING TABLE REFERENCE RULE ref_order(t_item,t_order);
错误
Invalid `sharding table` rules `[ref_order]`, error messages are: [invalid sharding table reference.]
分析:
如果将 t_order 和 t_item 的 DATANODES 都修改为 "ds_0.t_order_${2023..2025}_0${1..9},ds_0.t_order_${2023..2025}_${10..12}" 则可以绑定
官方文档如下说明:
1、关联的分片表应分布在相同的存储单元,并且分片个数相同。例如 ds_${0..1}.t_order_${0..1} 与 ds_${0..1}.t_order_item_${0..1};
2、关联的分片表应使用一致的分片算法。例如 t_order_${order_id % 2} 与 t_order_item_${order_item_id % 2};
希望:
相同分表规则应该可以绑定表
--
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] TeslaCN commented on issue #28249: 多表绑定BUG,版本5.4/5.3.2
Posted by "TeslaCN (via GitHub)" <gi...@apache.org>.
TeslaCN commented on issue #28249:
URL: https://github.com/apache/shardingsphere/issues/28249#issuecomment-1691455768
Does it matter?

--
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 #28249: 多表绑定BUG,版本5.4/5.3.2
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #28249:
URL: https://github.com/apache/shardingsphere/issues/28249#issuecomment-1692728992
Hi @devin-wanghuixiong, can you translate this issue to English? Besides, what are the sharding policies and algorithms you have configured?
--
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 closed issue #28249: Multi-table binding error, version 5.4/5.3.2
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #28249: Multi-table binding error, version 5.4/5.3.2
URL: https://github.com/apache/shardingsphere/issues/28249
--
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] devin-wanghuixiong commented on issue #28249: 多表绑定BUG,版本5.4/5.3.2
Posted by "devin-wanghuixiong (via GitHub)" <gi...@apache.org>.
devin-wanghuixiong commented on issue #28249:
URL: https://github.com/apache/shardingsphere/issues/28249#issuecomment-1692025575
> 感谢你的回复,此问题已困扰数天
> 由于代码使用了普通文本编辑,导致github显示时缺少了一个下划线,但正确的创建规则依然无法多表绑定
>
```sql
CREATE SHARDING TABLE RULE t_order( DATANODES("ds_0.t_order_${2023..2025}_0${1..9},ds_0.t_order_${2023..2025}_${10..12}"), AUDIT_STRATEGY (TYPE(NAME='DML_SHARDING_CONDITIONS'),ALLOW_HINT_DISABLE=TRUE));
CREATE SHARDING TABLE RULE t_item ( DATANODES("ds_0.t_item_${2023..2025}_0${1..9},ds_0.t_item_${2023..2025}_${10..12}"), AUDIT_STRATEGY (TYPE(NAME="DML_SHARDING_CONDITIONS"),ALLOW_HINT_DISABLE=TRUE)
```
> 生成的规则如下 
--
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] devin-wanghuixiong commented on issue #28249: 多表绑定BUG,版本5.4/5.3.2
Posted by "devin-wanghuixiong (via GitHub)" <gi...@apache.org>.
devin-wanghuixiong commented on issue #28249:
URL: https://github.com/apache/shardingsphere/issues/28249#issuecomment-1691991565
感谢你的回复,此问题已困扰数天
多次测试导致语句拷贝错误,但正确的规则语句依然无法绑定表
CREATE SHARDING TABLE RULE t_order(
DATANODES("ds_0.t_order_${2023..2025}_0${1..9},ds_0.t_order_${2023..2025}_${10..12}"),
AUDIT_STRATEGY (TYPE(NAME='DML_SHARDING_CONDITIONS'),ALLOW_HINT_DISABLE=TRUE));
CREATE SHARDING TABLE RULE t_item (
DATANODES("ds_0.t_item_${2023..2025}_0${1..9},ds_0.t_item_${2023..2025}_${10..12}"),
AUDIT_STRATEGY (TYPE(NAME="DML_SHARDING_CONDITIONS"),ALLOW_HINT_DISABLE=TRUE)
生成的规则如下

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