Problem
Performing Instant add column and Online DDL consecutively on a table causes a crash.
Problem Triggering Scenarios
Performing Instant DDL on a table followed consecutively by Online DDL operations such as OPTIMIZE TABLE or ALTER TABLE .. ADD PRIMARY KEY may cause a program crash due to improper code handling (failing to use the INSTANT algorithm for column addition or the REDUNDANT format).
The Kernel Version Involved in the Issue
MySQL 8.0 20221221 and earlier versions.
Fixed Kernel Version
MySQL 8.0 20241005.
Inspection Method
You can refer to the following commands to check for tables with potential risks.
select replace(name, '/', '.') as 'table_schema.table_name' from information_schema.innodb_tables where TOTAL_ROW_VERSIONS!=0 or INSTANT_COLS!=0;
Fixing Method
2. After upgrading the kernel version, rebuild and repair the corrupted tables. This can be repaired via alter table xx engine = innodb;. To avoid business impact caused by table locking, it is recommended to perform the repair during off-peak hours using tools such as pt-osc.