Bug #41754 | 'Cannot add or update a child row: a foreign key constraint fails' on SBR+Innodb | ||
---|---|---|---|
Submitted: | 26 Dec 2008 12:03 | Modified: | 24 Mar 2009 9:44 |
Reporter: | Philip Stoev | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S2 (Serious) |
Version: | 5.0.70, 5.1.30, 6.0.9 | OS: | Any |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[26 Dec 2008 12:03]
Philip Stoev
[29 Dec 2008 10:19]
Sveta Smirnova
Thank you for the report. But where is test case for bug #39440 is located?
[29 Dec 2008 11:07]
Philip Stoev
The actual test case is under bug 41395. I am sorry for the confusion, they are related bugs with very similar stack traces.
[31 Dec 2008 8:18]
Sveta Smirnova
Thank you for the feedback. Verified as described.
[13 Jan 2009 16:11]
David Dewar
Sorry to be a nuisance, but does anyone have a solutions to this yet? Replication works fine for me until someone performs an insert into a table with a foreign key constraint - then replication fails. Is there a way to work around this?
[16 Jan 2009 20:14]
Andrei Elkin
Actually, the test indicates the problem in 5.1.29 as well, but does not in aelkin@mysql.com-20081002084223-6evhpt47cko8he59 and (most probably) earlier.
[20 Jan 2009 21:11]
Andrei Elkin
Inserting into more than one autoincrement tables is unsafe for SBR as bug#19630 stated.
[16 Mar 2009 19:39]
Andrei Elkin
Wrt a possible solution I am sorry to be able only to quote: Bug #19630 comments [4 May 2007 7:03] "This bug has been discussed numerous time. Lars and Jeffrey made the decision that we will not fix this problem in 5.0 now because (a) it's too complicated a fix and (b) the problem has been fixed in 5.1. Limitation has been documented. Bug cannot be escalated." Upgrading to 5.1 and using the mixed replication format would be a good enough solution. The mixed format forces the actual binlogging of the two-or-more auto-inc inserts in the row-based format.
[24 Mar 2009 9:44]
Andrei Elkin
Setting it as a duplicate of bug#19630. The regression test uses stored functions that insert into an auto-inc column so that in effect there can be inserts into at least 2 auto-inc columns per query. That is unsafe for binlogging. And the server warns that. E.g a query from the ddl part of the regression test mysql> INSERT INTO test.insdel2_sub VALUES (null, NAME_CONST('ins_count',100), 'More text to test with'); Query OK, 1 row affected, 2 warnings (0.00 sec) generates: mysql> show warnings; +---------+------+---------------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------------+ | Warning | 1592 | Statement is not safe to log in statement format. | | Warning | 1592 | Statement is not safe to log in statement format. | +---------+------+---------------------------------------------------+