mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
Problem: ======== After an instant ALTER TABLE that reorders or drops columns, innobase_instant_try() deletes/updates SYS_COLUMNS, SYS_VIRTUAL and SYS_TABLES.N_COLS, and only afterwards writes the hidden metadata record that describes the old column layout in the clustered index. These are separate mini-transactions within the same DDL transaction. If the server is killed after the SYS_COLUMNS/SYS_TABLES updates were made durable but before the metadata record was written, and recovery does not roll back the transaction then table's dictionary definition and its on-disk metadata record go out of sync. On the next load, btr_cur_instant_init_low() correctly detects this as "missing instant ALTER metadata" or "contains unrecognizable instant ALTER metadata" and sets table->corrupted, but it did not set table->file_unreadable. Since dict_table_t::is_readable() only tests file_unreadable, the table was left in an inconsistent corrupted-but-readable state. Solution: ========= btr_cur_instant_init_low(): Also set index->table->file_unreadable in the "missing instant ALTER metadata" and "incompatible instant ALTER metadata" error paths, consistent with every other corruption path in this function.