-
Marko Mäkelä authored
There was a race condition between ALTER TABLE and purge. If a table turns out to be logically empty when instant ALTER TABLE is executing, we will convert the table to the canonical format, to avoid overhead during subsequent accesses, and to allow the data file to be imported into older versions of MariaDB. It could happen that at the time the table is logically empty, there still exists an undo log record for updating the hidden metadata record for an earlier instant ALTER TABLE operation. If the table was converted to the canonical format before purge processes this undo log record, the undo log record could be referring to index fields that no longer exist, causing a crash. To prevent the race condition, we must delete the old undo log records. We do this lazily by assigning a new table ID, so that the table lookup for the old undo log records will fail. dict_table_t::reassign_id(): Reassign the table_id to effectively lazily delete old undo log records. innobase_instant_try(): Invoke index->table->reassign_id() before index->clear_instant_alter().
2ebb110c