Bug #57255 | Cascade Delete results in "Got error -1 from storage engine" | ||
---|---|---|---|
Submitted: | 5 Oct 2010 16:27 | Modified: | 30 Nov 2010 23:34 |
Reporter: | Walt Stoneburner | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S2 (Serious) |
Version: | 5.1.51-community | OS: | Any (MS Windows 7, Linux) |
Assigned to: | Jimmy Yang | CPU Architecture: | Any |
Tags: | -1, 1030, cascading, constraints, depth, engine, error, foreign, hy000, key, MAX, regression, storage |
[5 Oct 2010 16:27]
Walt Stoneburner
[5 Oct 2010 19:58]
Sveta Smirnova
Thank you for the report. Verified as described. Versions 5.0 and 5.6.99 are not affected. Plugin is affected. Test case for MTR: --source include/have_innodb.inc create table A(id int not null primary key) engine=innodb; create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb; create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb; insert into A values(1), (2); --disable_query_log let $i=257; while ($i) { insert into B(f1) values(1); dec $i; } let $i=486; while ($i) { insert into C(f1) values(2); dec $i; } --enable_query_log --disable_abort_on_error DELETE FROM A where id = 1; DELETE FROM C where f1 = 2; DELETE FROM A where id = 1;
[5 Oct 2010 20:15]
Calvin Sun
Probably related to the fix of bug#54582.
[6 Oct 2010 3:41]
Jimmy Yang
Yes, it is related to #54582. We introduced fk_cascade_depth counter to prevent a running out recursive call to row_update_cascade_for_mysql(). This counter is initialized and reset in row_update_for_mysql(). Apparently, we should reset this counter when it comes out of recursive call immediately, so it does not accumulated with checks on different rows (as in this case) under a single row_update_for_mysql().
[6 Oct 2010 19:26]
John Russell
Added to change log: InnoDB incorrectly reported an error when a cascading foreign key constraint deleted more than 250 rows.
[9 Oct 2010 11:54]
Harald Reindl
Confirmed as introduced while upgrading from 5.1.50 to 5.1.51 In our setup this hits the daily dbmail-cleanup Repairing DBMAIL physmessage integrity... Ok. Found [2] unconnected physmessagesWarning: could not delete orphaned physmessages. Check log. InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 250 Please drop excessive foreign constraints and try again
[15 Oct 2010 6:22]
Andrew Haveland-Robinson
I just came across this too and want to be clear - is it a 'pretend' error, or are the cascades ignored/rolled back? Fortunately it was on a disposable slave which I downgraded to 5.1.50 and reloaded.
[15 Oct 2010 13:35]
Walt Stoneburner
I don't think this bug is "pretend" at all. It would not let me do important DELETE operations, aborting them and rolling back the transaction. It's my personal opinion that this is actually quite serious to have in production, and I'm eagerly awaiting the fix to be rolled out to the public. In fact, its impact is so significant that deploying from http://labs.mysql.com/ has become an option.
[15 Oct 2010 14:09]
Andrew Haveland-Robinson
Thanks for the clarification Walt, I agree that this can be a show-stopper for serious applications and hope it can be patched soon.
[29 Oct 2010 12:03]
Harald Reindl
Can anybody put the fucking 5.1.52 on the servers? > D.1.1. Changes in MySQL 5.1.52 (11 October 2010) > Bugs fixed: > InnoDB Storage Engine: InnoDB incorrectly reported an error when > a cascading foreign key constraint deleted more than 250 rows. > (Bug#57255) It does not help anybody that the release is ready since more than two weeks when there is no download
[29 Oct 2010 12:12]
Mattias Aspholm
Agree with previous speaker! This bug is a show stopper and makes 5.1.51 useless for many applications, including the one I'm working with. If there's a fix ready, why don't you get it out?
[1 Nov 2010 11:37]
Harald Reindl
Is this the new way oracle will handle the mysql-community like opensolaris, openoffice not so long ago? This damn bug is in a category where normally a urgent update should be pushed and not waiting weeks to place the download on the server even after the next version is finished
[1 Nov 2010 19:00]
Bugs System
Pushed into mysql-5.1 5.1.53 (revid:build@mysql.com-20101101184443-o2olipi8vkaxzsqk) (version source revid:build@mysql.com-20101101184443-o2olipi8vkaxzsqk) (merge vers: 5.1.53) (pib:21)
[2 Nov 2010 6:28]
James Day
Harald, Mattias, the date isn't the date that 5.1.52 was released. It's the date that a branch to prepare for testing and release was created, indicating that bug fixes produced after that won't normally be included in that version. Those tests, and adding fixes for any problems they find, take a while and we aren't going to ship an untested build. 5.1.52 was released on 1 November to all parts of the community, both those with support contracts and those without, though it can take a day or so for some mirrors to have a build available. Prior to that there was the option to use a daily development build, to use an older release or to incorporate the patch and build yourself, as usual for open source projects. Or, for those with appropriate support contract, we'd do the build for someone ourselves if it was a critical production problem. Sorry about the aggravation.
[2 Nov 2010 12:41]
Harald Reindl
First THANK YOU I deployed 5.1.52 last night and 9.000 old mails could be deleted If this is not the release date this should not named "released" This was a bug in a category where a mysql-5.1.51.1 would make sense because it was a real show stopper, the deletion of old mails is not the only problem, you could not even delete a user / domain at dbmail
[3 Nov 2010 5:24]
James Day
Harald, thanks for confirming that it's worked for you. I've passed on your suggestion to our documentation team lead. I agree that it would be good to be more explicit about what the dates mean and perhaps to give both.
[9 Nov 2010 19:49]
Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (version source revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (merge vers: 5.5.7-rc) (pib:21)
[13 Nov 2010 16:10]
Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:alexander.nozdrin@oracle.com-20101113152450-2zzcm50e7i4j35v7) (merge vers: 5.6.1-m4) (pib:21)
[13 Nov 2010 16:42]
Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (pib:21)