admin管理员组文章数量:1025278
I'm working with two servers MariaDB with galera replication and MaxScale rw router.
One server takes write queryies only, the other one just selects.
I have this sequence of operations:
- start transaction with propagation REQUIRES_NEW and isolation READ_COMMITTED
- insert new record in tableA and get ID
- insert new record in tableB using previous inserted ID as foreign key to tableA
- commit
- fails with
Error: 1451-23000: Cannot delete or update a parent row: a foreign key constraint fails
This is not a systematics issue; most times it works without error, but a few times it fails. It may be connected to replication; that answers why most times it works and why the issue is thrown after the commit.
What I'm missing?
The issue doesn't arise from the master-write database because it is the database of the first tableA insertion. It is more likely the issue comes from the second server at replication time.
But since the transaction is unique and the replication works by entire transactions, how is it possibile that the foreign key doesn't work?
I'm working with two servers MariaDB with galera replication and MaxScale rw router.
One server takes write queryies only, the other one just selects.
I have this sequence of operations:
- start transaction with propagation REQUIRES_NEW and isolation READ_COMMITTED
- insert new record in tableA and get ID
- insert new record in tableB using previous inserted ID as foreign key to tableA
- commit
- fails with
Error: 1451-23000: Cannot delete or update a parent row: a foreign key constraint fails
This is not a systematics issue; most times it works without error, but a few times it fails. It may be connected to replication; that answers why most times it works and why the issue is thrown after the commit.
What I'm missing?
The issue doesn't arise from the master-write database because it is the database of the first tableA insertion. It is more likely the issue comes from the second server at replication time.
But since the transaction is unique and the replication works by entire transactions, how is it possibile that the foreign key doesn't work?
本文标签:
版权声明:本文标题:mariadb - Cannot delete or update a parent row: a foreign key constraint fails with Galera and MaxScale - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745614132a2159182.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论