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

              People

              • Assignee:
                kevg Eugene Kosov
                Reporter:
                rhafer Ralf Haferkamp
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: