mycat1.3 需要根据表的e-r关系

MySql 码拜 9年前 (2015-11-25) 891次浏览
mycat1.3  E-R分片问题
需要根据表的e-r关系进行分片
两张表分别为
create table tmp_parent(id int not null  PRIMARY key ,dn_id  int ) ;
create table tmp_child(id int not null PRIMARY key ,pid int );
按照tmp_parent表中dn_id进行分片,分片规则很简单,这个数字是多少就分在哪个片。子表tmp_child根据pid去关联tmp_parent.id,跟随父表一起放
配置schema中的表字段
<schema name=”rawinfo” checkSQLschema=”false” sqlMaxLimit=”100″>
<table name=”tmp_parent” primaryKey=”id” dataNode=”dn1,dn2,dn3,dn4,dn5,dn6,dn7,dn8,dn9,dn10″
rule=”sharding-by-intfile2″>
<childTable name=”tmp_child”  primaryKey=”id” joinKey=”pid”
parentKey=”id”>
</childTable>
</table>
</schema>
插入父表能正确执行
insert into tmp_parent(id,dn_id) values(1,1);
但是插入字表的时候会运行很长时间然后报错
insert into tmp_child(id,pid) values(1,1) ;
错误提示:
[SQL]
insert into tmp_child(id,pid) values(1,1) ;
[Err] 1064 – can””t find (root) parent sharding node for sql:INSERT INTO tmp_child (id, pid)
VALUES (1, 1)
这种难道不能实现的吗?

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明mycat1.3 需要根据表的e-r关系
喜欢 (0)
[1034331897@qq.com]
分享 (0)