Bug #29154 | LOCK TABLES is not atomic when >1 InnoDB tables are locked | ||
---|---|---|---|
Submitted: | 16 Jun 2007 7:29 | Modified: | 4 Jul 2007 1:52 |
Reporter: | Valeriy Kravchuk | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.0.44-BK, 5.0.40 | OS: | Linux |
Assigned to: | Georgi Kodinov | CPU Architecture: | Any |
Tags: | bfsm_2007_06_21, bfsm_2007_06_28, regression |
[16 Jun 2007 7:29]
Valeriy Kravchuk
[16 Jun 2007 7:30]
Valeriy Kravchuk
Verified with latest 5.0.44-BK on Linux. This is a regression bug of a kind, as 4.1.19, for example, had no issues like this.
[20 Jun 2007 22:43]
Konstantin Osipov
See also Bug#28870
[22 Jun 2007 16:23]
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/29426 ChangeSet@1.2500, 2007-06-22 19:20:55+03:00, gkodinov@magare.gmz +4 -0 Bug #29154: LOCK TABLES is not atomic when >1 InnoDB tables are locked LOCK TABLES takes a list of tables to lock. It may lock several tables successfully and then encounter a tables that it can't lock, e.g. because it's locked. In such case it needs to undo the locks on the already locked tables. And it does that. But it has also notified the relevant table storage engine handlers that they should lock. The only reliable way to ensure that the table handlers will give up their locks is to end the transaction. This is what UNLOCK TABLE does : it ends the transaction if there were locked tables by LOCK tables. It is possible to end the transaction when the lock fails in LOCK TABLES because LOCK TABLES ends the transaction at its start already. Fixed by ending (again) the transaction when LOCK TABLES fails to lock a table.
[23 Jun 2007 9:00]
Konstantin Osipov
The reason 4.1 does not have this regression is that in 4.1 InnoDB would always trigger a server-wide transaction rollback on lock timeout or deadlock. In 5.0 it has become optional.
[25 Jun 2007 7:50]
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/29480 ChangeSet@1.2500, 2007-06-25 10:44:52+03:00, gkodinov@magare.gmz +3 -0 Bug #29154: LOCK TABLES is not atomic when >1 InnoDB tables are locked LOCK TABLES takes a list of tables to lock. It may lock several tables successfully and then encounter a tables that it can't lock, e.g. because it's locked. In such case it needs to undo the locks on the already locked tables. And it does that. But it has also notified the relevant table storage engine handlers that they should lock. The only reliable way to ensure that the table handlers will give up their locks is to end the transaction. This is what UNLOCK TABLE does : it ends the transaction if there were locked tables by LOCK tables. It is possible to end the transaction when the lock fails in LOCK TABLES because LOCK TABLES ends the transaction at its start already. Fixed by ending (again) the transaction when LOCK TABLES fails to lock a table.
[1 Jul 2007 19:58]
Bugs System
Pushed into 5.1.21-beta
[1 Jul 2007 20:02]
Bugs System
Pushed into 5.0.46
[4 Jul 2007 1:52]
Paul DuBois
Noted in 5.0.46, 5.1.21 changelogs. LOCK TABLES was not atomic when more than one InnoDB tables were locked.