Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-3197

LP:498227 - MySQL crashes when InnoDB column is renamed and then added to an index, due to fast index creation bug

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      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.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            knielsen Kristian Nielsen added a comment -

            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.

            Show
            knielsen Kristian Nielsen added a comment - 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.
            Hide
            knielsen Kristian Nielsen added a comment -

            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.

            Show
            knielsen Kristian Nielsen added a comment - 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.
            Hide
            ratzpo Rasmus Johansson added a comment -

            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.

            Show
            ratzpo Rasmus Johansson added a comment - 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.
            Hide
            knielsen Kristian Nielsen added a comment -

            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).

            Show
            knielsen Kristian Nielsen added a comment - 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).
            Hide
            monty Michael Widenius added a comment -

            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.

            Show
            monty Michael Widenius added a comment - 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.
            Hide
            stewart Stewart Smith added a comment -

            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.

            Show
            stewart Stewart Smith added a comment - 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.
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 498227

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 498227

              People

              • Assignee:
                Unassigned
                Reporter:
                caseyforbes Casey Forbes
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: