| Bug #34432 | Wrong lock type passed to the engine if pre-locking + multi-update in a trigger | ||
|---|---|---|---|
| Submitted: | 8 Feb 2008 20:15 | Modified: | 4 Aug 2010 23:10 |
| Reporter: | Konstantin Osipov (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Locking | Severity: | S3 (Non-critical) |
| Version: | 5.0,5.1,6.0-bk | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[11 Feb 2008 9:59]
MySQL Verification Team
Thank you for the bug report. c:\dbs>5.1\bin\mysqld-debug --standalone --console 080211 7:57:08 InnoDB: Started; log sequence number 0 46409 080211 7:57:15 [Note] Event Scheduler: Loaded 0 events 080211 7:57:15 [Note] 5.1\bin\mysqld-debug: ready for connections. Version: '5.1.24-rc-nt-debug-log' socket: '' port: 3306 Source distribution Assertion failed: lock_type != TL_UNLOCK, file c:\dbs\mysql-5.1\sql\handler.h, line 1382
[10 Jul 2008 14:02]
Guilhem Bichot
In the latest 6.0-main tree, the same bug happens in grant.test (i.e. if you add the assertion to ha_myisam.h, it fires in grant.test).
[9 Sep 2008 18:01]
Guilhem Bichot
Note that now this crashes the debug binary of 6.0-bk: ./mtr --mysqld=--default-storage-engine=maria --skip-ndb --force --notimer --mem grant This isn't a Maria problem per se, it's the fact that start_stmt() is called with a wrong lock type.
[25 Sep 2009 19:06]
Davi Arnaut
Lars-Erik, this one has been fixed by the patch for Bug#34432. Please commit the test case and assert.
[25 Sep 2009 19:46]
Davi Arnaut
Correcting: fixed by Bug#39843
[29 Sep 2009 11:49]
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/84980 3626 lars-erik.bjork@sun.com 2009-09-29 Bug#34432 - "Wrong lock type passed to the engine if pre-locking + multi-update in a trigger". This bug is supposedly fixed by the patch for #39843. This patch adds a DBUG_ASSERT, and a test case, ensuring that the assert is not triggered. However, the main.grant test triggers the assert. modified: mysql-test/r/trigger.result mysql-test/t/trigger.test sql/handler.h
[2 Oct 2009 9:06]
Konstantin Osipov
Can't be pushed until the firing assert is fixed.
[9 Oct 2009 11:33]
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/86336 3651 lars-erik.bjork@sun.com 2009-10-09 This patch includes a test case for bug#34432 (Wrong lock type passed to the engine if pre-locking + multi-update in a trigger). The assert suggested in the bug report is not included in this patch, as it results in bug # 47938. @ mysql-test/r/trigger.result The result of the test @ mysql-test/t/trigger.test The test case.
[23 Oct 2009 14:34]
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/87975 3668 lars-erik.bjork@sun.com 2009-10-23 [merge] This patch includes a test case for bug#34432 (Wrong lock type passed to the engine if pre-locking + multi-update in a trigger). The assert suggested in the bug report is not included in this patch, as it results in bug # 47938. @ mysql-test/r/trigger.result The result of the test. @ mysql-test/t/trigger.test The test case.
[23 Oct 2009 14:38]
Lars-Erik Bjørk
Pushed into 6.0.14-alpha
[31 Oct 2009 8:16]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091031081410-qkxmjsdzjmj840aq) (version source revid:lars-erik.bjork@sun.com-20091023144155-4s5ywv0rmy1e307u) (merge vers: 6.0.14-alpha) (pib:13)
[31 Oct 2009 17:36]
Paul DuBois
Test case changes. No changelog entry needed.
[19 May 2010 13:26]
Jon Olav Hauglid
Backported to mysql-next-mr (Ver 5.6.99-m4).
[19 May 2010 13:28]
Jon Olav Hauglid
Should be "backported to mysql-next-mr-bugfixing".
[20 May 2010 10:03]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100520100225-oe4iuu5kuzsx0knq) (version source revid:alik@sun.com-20100520100057-rmn5y3o3ij726bm7) (merge vers: 6.0.14-alpha) (pib:16)
[20 May 2010 10:06]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100520100140-5bzrtadw4w419i3m) (version source revid:alik@sun.com-20100520100049-1njm09rkvnhmysnr) (pib:16)
[4 Aug 2010 8:05]
Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:alik@sun.com-20100520123900-5kadc9fvcxz30s75) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 8:21]
Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:alik@sun.com-20100520123900-5kadc9fvcxz30s75) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 23:10]
Paul DuBois
No changelog entry needed.

Description: If pre-locking is used and a MULTI-UPDATE statement is inside a trigger, the underlying storage engine is passed a wrong lock type. How to repeat: ===== handler.h 1.282 vs edited ===== Apply the following patch to the server to trigger an assert: --- 1.282/sql/handler.h 2007-12-20 21:16:51 +03:00 +++ edited/sql/handler.h 2008-02-08 22:37:43 +03:00 @@ -1375,7 +1375,11 @@ */ virtual void try_semi_consistent_read(bool) {} virtual void unlock_row() {} - virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;} + virtual int start_stmt(THD *thd, thr_lock_type lock_type) + { + DBUG_ASSERT(lock_type != TL_UNLOCK); + return 0; + } virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, Use the following test case: CREATE TABLE test.t2 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id)); CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program CHAR(30),keey CHAR(30),PRIMARY KEY(domain_id)); CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id)); delimiter | CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'| delimiter ; INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com'); INSERT INTO test.t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');