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

Database corruption after renaming a prefix-indexed column

Details

    Description

      It seems that under certain conditions a simple "alter table" statement to rename a column can cause the database to go bad. This is what I do to reproduce the issue:

      (Basically creating a table with the primary key on two columns, after that renaming one of the columns)
      -------------------
      create database test42;
      use test42;
      create table `test` ( `test_old` varchar(255) NOT NULL,
      `other` varchar(255) NOT NULL,
      PRIMARY KEY (`test_old`,`other`) );

      alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL;
      select * from test;
      -------------------

      Up to here it works fine. Now after I restart the server (systemctl restart mariadb). I get this after rerunning the select statement.

      ---------------------
      select * from test;
      ERROR 1932 (42S02): Table 'test42.test' doesn't exist in engine
      ---------------------

      So something went wrong with that "test" table.

      BTW, the above is just a minimized test case, we orginally noticed this issue when trying to use 10.2.19 with openstack-neutron (which needs to run schemamigrations similar to the above).

      Attachments

        Issue Links

          Activity

            rhafer Ralf Haferkamp created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            Component/s Storage Engine - InnoDB [ 10129 ]
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Affects Version/s 10.2 [ 14601 ]
            Affects Version/s 10.3 [ 22126 ]
            Affects Version/s 10.4 [ 22408 ]
            Assignee Marko Mäkelä [ marko ]
            Labels regression
            Priority Major [ 3 ] Blocker [ 1 ]
            elenst Elena Stepanova made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Eugene Kosov [ kevg ]
            kevg Eugene Kosov (Inactive) made changes -
            Assignee Eugene Kosov [ kevg ] Marko Mäkelä [ marko ]
            Status Confirmed [ 10101 ] In Review [ 10002 ]
            marko Marko Mäkelä made changes -
            Summary Database corruption after altering column name Database corruption after renaming a prefix-indexed column
            marko Marko Mäkelä made changes -
            issue.field.resolutiondate 2018-12-29 21:30:32.0 2018-12-29 21:30:32.367
            marko Marko Mäkelä made changes -
            Fix Version/s 10.4.2 [ 23229 ]
            Fix Version/s 10.2.21 [ 23213 ]
            Fix Version/s 10.3.12 [ 23214 ]
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Assignee Marko Mäkelä [ marko ] Eugene Kosov [ kevg ]
            Resolution Fixed [ 1 ]
            Status In Review [ 10002 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 91327 ] MariaDB v4 [ 155383 ]

            People

              kevg Eugene Kosov (Inactive)
              rhafer Ralf Haferkamp
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.