Skip to content

Commit c6de271

Browse files
Vidhya Sree Rajuladevidahlerlend
authored andcommitted
Bug #35449266 - An ALTER TABLE query corrupted the data dictionary so
mysqld crashes Background: Column names are case insensitive in MySQL. When "ALTER TABLE .. ADD COLUMN .. ALGORITHM=INSTANT" is triggered, the new row version is created for this record. This version is stored on disk with record and the column's metadata information is updated in storage engine (se_private_data). And when "ALTER TABLE .. CHANGE COLUMN" is triggered, we check if the column is renamed and the old column's metadata is copied to new column. Issue: While checking if the column is renamed, we compare the name of the column in the create table info with that of in the alter table info. But here the comparison is case sensitive which causes c1 to differ from C1. Thus returning a nullptr when get_renamed_col() is called, i.e., doesn't detect column rename and further leads to skipping the updation of physical position of newly renamed column. Which is why it hits the assertion failure in debug build where a renamed column should have the physical position updated already. Fix: The solution is to compare the column names while ignoring the case sensitivity. Change-Id: Ic30b183666da466a553cea45eb7028be3c2a36bb
1 parent 54d003b commit c6de271

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

storage/innobase/handler/handler0alter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ static dd::Column *get_renamed_col(const Alter_inplace_info *ha_alter_info,
475475
Create_field *cf;
476476
while ((cf = cf_it++) != nullptr) {
477477
if (cf->field && cf->field->is_flag_set(FIELD_IS_RENAMED) &&
478-
strcmp(cf->change, old_dd_column->name().c_str()) == 0) {
478+
innobase_strcasecmp(cf->change, old_dd_column->name().c_str()) == 0) {
479479
/* This column is being renamed */
480480
return (const_cast<dd::Column *>(
481481
dd_find_column(&new_dd_tab->table(), cf->field_name)));

0 commit comments

Comments
 (0)