Bug #38804 | Query deadlock causes all tables to be inaccessible. | ||
---|---|---|---|
Submitted: | 14 Aug 2008 16:27 | Modified: | 17 Oct 2008 18:16 |
Reporter: | Philip Stoev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Locking | Severity: | S1 (Critical) |
Version: | 5.1-bzr | OS: | Any |
Assigned to: | Mattias Jonsson | CPU Architecture: | Any |
[14 Aug 2008 16:27]
Philip Stoev
[15 Aug 2008 7:43]
Sveta Smirnova
Thank you for the report. Verified as described.
[28 Aug 2008 16:01]
Mattias Jonsson
Is this repeatable in 6.0? I think that the auto_increment patch that fixed bug#33479 might solve this bug too (since it does no longer use the table_share->mutex). (that patch has only been included in 6.0, not in 5.1)
[29 Aug 2008 9:47]
Kristofer Pettersson
Bug has its origin from: http://bugs.mysql.com/bug.php?id=27405
[1 Sep 2008 14:15]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/53007 2728 Kristofer Pettersson 2008-09-01 Bug#38804 Query deadlock causes all tables to be inaccessible. Backport 6.0-> 5.1 of b ug 33479: auto_increment failures in partitioning Several problems with auto_increment in partitioning (with MyISAM, InnoDB and Falcon. Locking issues, not handling multi-row INSERTs properly etc.) This is a full patch which I have updated according to sergs and guilhems comments. Changed the auto_increment handling for partitioning: Added a ha_data variable in table_share for storage engine specific data such as auto_increment value handling in partitioning, also see WL 4305 and using the ha_data->mutex to lock around read + update. The idea is this: Store the table's reserved auto_increment value in the TABLE_SHARE and use a mutex to, lock it for reading and updating it and unlocking it, in one block. Only accessing all partitions when it is not initialized. Also allow reservations of ranges, and if no one has done a reservation afterwards, lower the reservation to what was actually used after the statement is done (via release_auto_increment from WL 3146). The lock is kept from the first reservation if it is statement based replication and a multi-row INSERT statement where the number of candidate rows to insert is not known in advance (like INSERT SELECT, LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)). This should also lead to better concurrancy (no need to have a mutex protection around write_row in all cases) and work with any local storage engine.
[2 Sep 2008 13:29]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/53061 2732 Mattias Jonsson 2008-09-02 Bug#38804: Query deadlock causes all tables to be inaccessible. Problem was a mutex added in bug n 27405 for solving a problem with auto_increment in partitioned innodb tables. (in ha_partition::write_row over partitions file->ha_write_row) Solution is to use the patch for bug#33479, which refines the usage of mutexes for auto_increment. Backport of bug-33479 from 6.0: Bug-33479: auto_increment failures in partitioning Several problems with auto_increment in partitioning (with MyISAM, InnoDB. Locking issues, not handling multi-row INSERTs properly etc.) Changed the auto_increment handling for partitioning: Added a ha_data variable in table_share for storage engine specific data such as auto_increment value handling in partitioning, also see WL 4305 and using the ha_data->mutex to lock around read + update. The idea is this: Store the table's reserved auto_increment value in the TABLE_SHARE and use a mutex to, lock it for reading and updating it and unlocking it, in one block. Only accessing all partitions when it is not initialized. Also allow reservations of ranges, and if no one has done a reservation afterwards, lower the reservation to what was actually used after the statement is done (via release_auto_increment from WL 3146). The lock is kept from the first reservation if it is statement based replication and a multi-row INSERT statement where the number of candidate rows to insert is not known in advance (like INSERT SELECT, LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)). This should also lead to better concurrancy (no need to have a mutex protection around write_row in all cases) and work with any local storage engine.
[3 Sep 2008 8:22]
Kristofer Pettersson
Dead lock visualized
Attachment: bug38804.swf (application/x-shockwave-flash, text), 64.78 KiB.
[3 Sep 2008 21:06]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/53206 2733 Mattias Jonsson 2008-09-03 Bug#38804: Query deadlock causes all tables to be inaccessible. Bug-33479: auto_increment failures in partitioning fix for update of auto_increment column (Same bug exists in non partitioned InnoDB, bug-39207)
[8 Sep 2008 13:30]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/53529 2732 Mattias Jonsson 2008-09-08 Bug#38804: Query deadlock causes all tables to be inaccessible. Problem was a mutex added in bug n 27405 for solving a problem with auto_increment in partitioned innodb tables. (in ha_partition::write_row over partitions file->ha_write_row) Solution is to use the patch for bug#33479, which refines the usage of mutexes for auto_increment. Backport of bug-33479 from 6.0: Bug-33479: auto_increment failures in partitioning Several problems with auto_increment in partitioning (with MyISAM, InnoDB. Locking issues, not handling multi-row INSERTs properly etc.) Changed the auto_increment handling for partitioning: Added a ha_data variable in table_share for storage engine specific data such as auto_increment value handling in partitioning, also see WL 4305 and using the ha_data->mutex to lock around read + update. The idea is this: Store the table's reserved auto_increment value in the TABLE_SHARE and use a mutex to, lock it for reading and updating it and unlocking it, in one block. Only accessing all partitions when it is not initialized. Also allow reservations of ranges, and if no one has done a reservation afterwards, lower the reservation to what was actually used after the statement is done (via release_auto_increment from WL 3146). The lock is kept from the first reservation if it is statement based replication and a multi-row INSERT statement where the number of candidate rows to insert is not known in advance (like INSERT SELECT, LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)). This should also lead to better concurrancy (no need to have a mutex protection around write_row in all cases) and work with any local storage engine.
[29 Sep 2008 9:06]
Mattias Jonsson
Estimated push to 5.1.29 is 2008-10-03.
[1 Oct 2008 10:41]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/54916 2694 Mattias Jonsson 2008-10-01 pre push fix for bug#38804
[1 Oct 2008 12:02]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/54920 2844 Mattias Jonsson 2008-10-01 [merge] merge (basically a null merge, since it contains a backport of bug#33479 as a fix for Bug#38804)
[1 Oct 2008 19:28]
Mattias Jonsson
pushed into mysql-6.0-5.1.29-rc and mysql-5.1-5.1.29-rc
[3 Oct 2008 9:31]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/55199 2686 Mattias Jonsson 2008-10-03 post push fix for bug#38804 (back port of bug#33479) Removes the regression bug#38751.
[3 Oct 2008 12:35]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/55246 2841 Mattias Jonsson 2008-10-03 [merge] merge and update of post push fix for bug#38804 There had also been a small miss in the previous merge between the 5.1.29-rc and -bugteam trees
[7 Oct 2008 19:21]
Paul DuBois
Noted in 5.1.29 changelog. For deadlock between two transactions that required a timeout to resolve, all server tables became inaccessible for the duration of the deadlock. Leaving report status unchanged; this is early documentation of an upcoming push into 5.1.29.
[9 Oct 2008 17:51]
Bugs System
Pushed into 5.1.30 (revid:mattias.jonsson@sun.com-20081003093054-0sc082k21jboj166) (version source revid:kgeorge@mysql.com-20081007082452-gk4l86zq8k53wwyo) (pib:4)
[9 Oct 2008 18:39]
Paul DuBois
Setting report to NDI pending push into 6.0.x.
[17 Oct 2008 16:46]
Bugs System
Pushed into 6.0.8-alpha (revid:mattias.jonsson@sun.com-20081008085925-xh27vrkzh2gx1k3u) (version source revid:kgeorge@mysql.com-20081008092313-4wzrak2duhsz7ylm) (pib:5)
[17 Oct 2008 18:16]
Paul DuBois
Noted in 6.0.8 changelog.
[28 Oct 2008 21:01]
Bugs System
Pushed into 5.1.29-ndb-6.2.17 (revid:mattias.jonsson@sun.com-20081003093054-0sc082k21jboj166) (version source revid:tomas.ulin@sun.com-20081028140209-u4emkk1xphi5tkfb) (pib:5)
[28 Oct 2008 22:20]
Bugs System
Pushed into 5.1.29-ndb-6.3.19 (revid:mattias.jonsson@sun.com-20081003093054-0sc082k21jboj166) (version source revid:tomas.ulin@sun.com-20081028194045-0353yg8cvd2c7dd1) (pib:5)
[1 Nov 2008 9:44]
Bugs System
Pushed into 5.1.29-ndb-6.4.0 (revid:mattias.jonsson@sun.com-20081003093054-0sc082k21jboj166) (version source revid:jonas@mysql.com-20081101082305-qx5a1bj0z7i8ueys) (pib:5)