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:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]