Bug #40877 | multi statement execution fails in 5.1.30 | ||
---|---|---|---|
Submitted: | 20 Nov 2008 9:35 | Modified: | 4 Nov 2010 1:41 |
Reporter: | Georg Richter | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 5.0/5.1/6.0 | OS: | Linux (x64) |
Assigned to: | Georgi Kodinov | CPU Architecture: | Any |
[20 Nov 2008 9:35]
Georg Richter
[20 Nov 2008 11:46]
MySQL Verification Team
Thank you for the bug report. Verified on 6.0/5.0 too. C:\temp>bug40877 Client: 5.1.31 Server: 5.1.31-nt-debug-log multi statement error: Cannot delete or update a parent row: a foreign key constraint fails C:\temp>bug60.exe Client: 6.0.9-alpha Server: 6.0.9-alpha-nt-debug-log multi statement error: Cannot delete or update a parent row: a foreign key constraint fails C:\temp>bug50.exe Client: 5.0.74 Server: 5.0.74-nt-log multi statement error:
[13 Oct 2009 15:15]
Georgi Kodinov
There's problems on two levels that prevent multi statements working as they should with this example : 1. The Innodb storage engine assumes the string returned by thd_query() (THD::query actually) is null-terminated. This is true with single statements. But with multi statements it's not true. Innodb should be extended to use char pointer/length instead of null-terminated strings. But it (currently) has no way getting this information out of the server. Which brings us to problem #2 2. The MySQL server has a THD::query_length that contains the length of THD::query. We need to expose this to the Innodb storage engine. This is best done by a new function that will return a LEX_STRING instead of char *. And while at it we may just as well wrap the string pointer and the length into a LEX_STRING internally and provide accessor methods for easy code update. I will use this bug report to track the solution of problem #2. #2 is a prerequisite for the real fix (#1). I will open a new bug for problem #1.
[13 Oct 2009 15:36]
Georgi Kodinov
Problem #2 reported as bug #48024.
[13 Oct 2009 16:20]
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/86705 3156 Georgi Kodinov 2009-10-13 Bug #40877: multi statement execution fails in 5.1.30 Implemented the server infrastructure for the fix: 1. Added a function LEX_STRING *thd_query_string(THD) to return a LEX_STRING structure instead of char *. This is the function that must be called in innodb instead of thd_query() 2. Did some encapsulation in THD : aggregated thd_query and thd_query_length into a LEX_STRING and made accessor and mutator methods for easy code updating. 3. Updated the server code to use the new methods where applicable.
[16 Oct 2009 10: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/87103 3177 Georgi Kodinov 2009-10-16 Bug #40877: multi statement execution fails in 5.1.30 Implemented the server infrastructure for the fix: 1. Added a function LEX_STRING *thd_query_string(THD) to return a LEX_STRING structure instead of char *. This is the function that must be called in innodb instead of thd_query() 2. Did some encapsulation in THD : aggregated thd_query and thd_query_length into a LEX_STRING and made accessor and mutator methods for easy code updating. 3. Updated the server code to use the new methods where applicable.
[16 Oct 2009 13:31]
Georgi Kodinov
Pushed in 5.1-bugteam and merged to mysql-pe
[22 Oct 2009 6:36]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091022063126-l0qzirh9xyhp0bpc) (version source revid:alik@sun.com-20091019135554-s1pvptt6i750lfhv) (merge vers: 6.0.14-alpha) (pib:13)
[11 Nov 2009 17:03]
Paul DuBois
Noted in 6.0.14 changelog. Multiple-statement execution could fail. Setting report to NDI pending push into 5.1.x, 5.5.x.
[18 Dec 2009 10:37]
Bugs System
Pushed into 5.1.41-ndb-7.1.0 (revid:jonas@mysql.com-20091218102229-64tk47xonu3dv6r6) (version source revid:jonas@mysql.com-20091218095730-26gwjidfsdw45dto) (merge vers: 5.1.41-ndb-7.1.0) (pib:15)
[18 Dec 2009 10:53]
Bugs System
Pushed into 5.1.41-ndb-6.2.19 (revid:jonas@mysql.com-20091218100224-vtzr0fahhsuhjsmt) (version source revid:jonas@mysql.com-20091217101452-qwzyaig50w74xmye) (merge vers: 5.1.41-ndb-6.2.19) (pib:15)
[18 Dec 2009 11:07]
Bugs System
Pushed into 5.1.41-ndb-6.3.31 (revid:jonas@mysql.com-20091218100616-75d9tek96o6ob6k0) (version source revid:jonas@mysql.com-20091217154335-290no45qdins5bwo) (merge vers: 5.1.41-ndb-6.3.31) (pib:15)
[18 Dec 2009 11:22]
Bugs System
Pushed into 5.1.41-ndb-7.0.11 (revid:jonas@mysql.com-20091218101303-ga32mrnr15jsa606) (version source revid:jonas@mysql.com-20091218064304-ezreonykd9f4kelk) (merge vers: 5.1.41-ndb-7.0.11) (pib:15)
[18 Dec 2009 20:34]
Paul DuBois
Setting report to NDI pending push into 5.1.x, 5.5.x.
[26 Mar 2010 16:07]
Paul DuBois
Noted in 5.1.42 changelog. Setting report to Need Merge pending push to Celosia.
[4 Nov 2010 1:41]
Paul DuBois
Noted in 5.5.7 changelog.