[MDEV-3197] LP:498227 - MySQL crashes when InnoDB column is renamed and then added to an index, due to fast index creation bug Created: 2009-12-18  Updated: 2012-10-04  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Casey Forbes (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug498227.xml    

 Description   

This is a pretty nasty one, because a simple "add index" statement can crash your database in a way that seems unpredictable. Bug is present in latest released MariaDB:

MySQL 44571: InnoDB Plugin crashes on ADD INDEX
http://bugs.mysql.com/bug.php?id=44571

The actual crash looks like so:

InnoDB: Error: no matching column for "renamed_column" in index "index_renamed_column"-temporary- of table "test"."test_table"!
091218 10:40:48 InnoDB: Assertion failure in thread 139964197152528 in file dict/dict0dict.c line 1768
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: about forcing recovery.
 091218 10:40:48 - mysqld got signal 6 ;
This could be because you hit a bug.



 Comments   
Comment by Kristian Nielsen [ 2009-12-21 ]

Re: MySQL crashes when InnoDB column is renamed and then added to an index, due to fast index creation bug
Thanks a lot for notifying us about the problem!

Seems that MySQL 5.1.41 contains a fix for this. This does not crash with the
innodb plugin in MySQL 5.1.41, instead it throws an error:

CREATE TABLE orgs ( salesperson INT) ENGINE=InnoDB;
ALTER TABLE orgs CHANGE salesperson sales_acct_id INT;
ALTER TABLE orgs ADD INDEX orgs$sales_acct_id (sales_acct_id);

In MariaDB latest trunk (which includes MySQL 5.1.41), it does crash. Seems we
lost the fix in the merge of MySQL 5.1.41. I will pull it in so that it will
be in MariaDB 5.1.41.

However, the MySQL fix really is not very nice. Seems basically after a column
is renamed, creating an index on that column no longer works. Since we use
XtraDB (which is based on the innodb plugin) by default, it seems to me we may
need a better solution for this in MariaDB.

Comment by Kristian Nielsen [ 2009-12-21 ]

Re: MySQL crashes when InnoDB column is renamed and then added to an index, due to fast index creation bug
Hm, looks like the fix for this in MySQL 5.1.41 was the inclusion of the InnoDB plugin version 1.0.5.

MariaDB is currently using XtraDB 8, which is based on InnoDB plugin version 1.0.4.

Seems the best way to include this fix then is to wait for the next XtraDB release and merge that into MariaDB.

The InnoDB plugin 1.0.5 has a test case for this.

We should still investigate if we can make a better fix for this. The problem seems to be that a column rename is performed without informing the storage engine, and InnoDB seems to rely on knowing the correct column names internally. Maybe for MariaDB 5.2 we can backport relevant parts of the 6.0 enhanced ALTER TABLE api.

Comment by Rasmus Johansson (Inactive) [ 2009-12-22 ]

Re: MySQL crashes when InnoDB column is renamed and then added to an index, due to fast index creation bug
lp:~percona-dev/percona-xtradb/extensions-1.0 (for 1.0.4)
lp:~percona-dev/percona-xtradb/extensions-1.0.5
lp:~percona-dev/percona-xtradb/extensions-1.0.6
All of them contains the first-aid patch for the bug. (never crash)

http://bugs.mysql.com/47621
http://bugs.mysql.com/47622

The project XtraDB doesn't contain patch for mysqld....
Of course, I will implement more, when the new interface will be added to the storage engine API.

Comment by Kristian Nielsen [ 2009-12-22 ]

Re: MySQL crashes when InnoDB column is renamed and then added to an index, due to fast index creation bug
Yasufumi, thanks for the information!

I should merge these additional fixes into MariaDB.

I tried to find these fixes in the Launchpad trees. It seems for example revisions 120 and 121 of lp: ~percona-dev/percona-xtradb/extensions-1.0 are relevant. As far as I can see, these have not been released yet, lp:percona-xtradb/release-9 is only up to revision 118.

So to merge, I need to merge from a release-xxx branch where the patches are already applied, not an extensions-xxx branch.

So please let me know if you will update lp:percona-xtradb/release-9 or other branch with latest patches from extensions-1.0, or if you prefer that I do it. (either way works for me, but we need to coordinate to use the same release-xxx branches or we will get problems with future merges).

Comment by Michael Widenius [ 2010-07-19 ]

Re: MySQL crashes when InnoDB column is renamed and then added to an index, due to fast index creation bug
Tested it in latest MariaDB 5.1.47 and no crash, so I assume the above merge is now done and the bug is fixed.

Comment by Stewart Smith [ 2011-06-07 ]

Re: MySQL crashes when InnoDB column is renamed and then added to an index, due to fast index creation bug
All development of XtraDB has moved under the Percona Server project - https://launchpad.net/percona-server - If this bug can be reproduced against current Percona Server, please file this bug against percona-server (you can simply do so by using the "Also affects project" link above).

Thanks,
Stewart Smith
Director of Server Development
Percona.

Comment by Rasmus Johansson (Inactive) [ 2011-06-07 ]

Launchpad bug id: 498227

Generated at Thu Feb 08 06:46:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.