[MDEV-18041] Database corruption after renaming a prefix-indexed column Created: 2018-12-20 Updated: 2019-01-08 Resolved: 2018-12-29 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server, Storage Engine - InnoDB |
| Affects Version/s: | 10.2.19, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.4.2, 10.2.21, 10.3.12 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Ralf Haferkamp | Assignee: | Eugene Kosov (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | regression | ||
| Environment: |
openSUSE Leap 15, SLES15, SLES12 |
||
| Issue Links: |
|
||||||||
| 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) alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL; Up to here it works fine. Now after I restart the server (systemctl restart mariadb). I get this after rerunning the select statement. --------------------- 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). |
| Comments |
| Comment by Elena Stepanova [ 2018-12-28 ] | ||||||||||||||||||||||||
|
Thanks for the report and test case, reproducible as described.
Reproducible on 10.2+, not reproducible on 10.1. However, it seems to have appeared in 10.2 tree with this merge:
| ||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-12-29 ] | ||||||||||||||||||||||||
|
This seems to be a regression caused by the merge of the | ||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-12-29 ] | ||||||||||||||||||||||||
|
The problem seems to be that both PRIMARY KEY columns (not only test_old, but also other) will be renamed to test_new in INFORMATION_SCHEMA.INNODB_SYS_FIELDS. This causes the following message to be emitted into the error log:
I do not immediately see why this would not happen in 10.0 or 10.1. (There have not been any 10.0 or 10.1 releases with this change yet.) | ||||||||||||||||||||||||
| Comment by Eugene Kosov (Inactive) [ 2018-12-29 ] | ||||||||||||||||||||||||
|
Yes it is a regression after My fix is here https://github.com/MariaDB/server/pull/1063 | ||||||||||||||||||||||||
| Comment by Niko Wittenbeck [ 2019-01-08 ] | ||||||||||||||||||||||||
|
Is there a way to directly update the INNODB_SYS_FIELDS table and to fix the columns manually (root lacks access)? Fixing that manually with table/db recreation is quite time-consuming. |