Skip to content

Commit 22bb026

Browse files
author
Vidhya Sree Rajuladevi
committed
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 8d6ded7 commit 22bb026

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
@@ -468,7 +468,7 @@ static dd::Column *get_renamed_col(const Alter_inplace_info *ha_alter_info,
468468
Create_field *cf;
469469
while ((cf = cf_it++) != nullptr) {
470470
if (cf->field && cf->field->is_flag_set(FIELD_IS_RENAMED) &&
471-
strcmp(cf->change, old_dd_column->name().c_str()) == 0) {
471+
innobase_strcasecmp(cf->change, old_dd_column->name().c_str()) == 0) {
472472
/* This column is being renamed */
473473
return (const_cast<dd::Column *>(
474474
dd_find_column(&new_dd_tab->table(), cf->field_name)));

0 commit comments

Comments
 (0)