• Marko Mäkelä's avatar
    MDEV-18775 Fix ALTER TABLE error handling for DROP INDEX · 4a1c6629
    Marko Mäkelä authored
    On an error (such as when an index cannot be dropped due to
    FOREIGN KEY constraints), the field dict_index_t::to_be_dropped
    was only being cleared in debug builds, even though the field
    is available and being used also in non-debug builds.
    
    This was a regression that was introduced by myself originally
    in MySQL 5.7.6 and later merged to MariaDB 10.2.2, in
    https://github.com/mysql/mysql-server/commit/d39898de8e0de21f64ce94cd4ea698675edfb447
    
    An error manifested itself in the MariaDB Server 10.4 non-debug build,
    involving instant ADD or DROP column. Because an earlier failed
    ALTER TABLE operation incorrectly left the dict_index_t::to_be_dropped
    flag set, the column pointers of the index fields would fail to be
    adjusted for instant ADD or DROP column (MDEV-15562). The instant
    ADD COLUMN in MariaDB Server 10.3 is unlikely to be affected by a
    similar scenario, because dict_table_t::instant_add_column() in 10.3
    is applying the transformations to all indexes, not skipping
    to-be-dropped ones.
    4a1c6629
alter_table.result 1.92 KB