• Marko Mäkelä's avatar
    Follow-up fix to MDEV-14585 Automatically remove #sql- tables in InnoDB dictionary during recovery · 656f66de
    Marko Mäkelä authored
    If InnoDB is killed while ALTER TABLE...ALGORITHM=COPY is in progress,
    after recovery there could be undo log records some records that were
    inserted into an intermediate copy of the table. Due to these undo log
    records, InnoDB would resurrect locks at recovery, and the intermediate
    table would be locked while we are trying to drop it. This would cause
    a call to row_rename_table_for_mysql(), either from
    row_mysql_drop_garbage_tables() or from the rollback of a RENAME
    operation that was part of the ALTER TABLE.
    
    row_rename_table_for_mysql(): Do not attempt to parse FOREIGN KEY
    constraints when renaming from #sql-something to #sql-something-else,
    because it does not make any sense.
    
    row_drop_table_for_mysql(): When deferring DROP TABLE due to locks,
    do not rename the table if its name already starts with the #sql-
    prefix, which is what row_mysql_drop_garbage_tables() uses.
    Previously, the too strict prefix #sql-ib was used, and some
    tables were renamed unnecessarily.
    656f66de
row0mysql.cc 136 KB