• Marko Mäkelä's avatar
    MDEV-19114 gcol.innodb_virtual_debug: Assertion n_fields>0 failed · cb437417
    Marko Mäkelä authored
    This is a regression due to MDEV-16376
    commit 8dc70c86.
    To make dict_index_t::detach_columns() idempotent,
    we cleared dict_index_t::n_fields. But, this could
    cause trouble with purge after a secondary index
    creation failed (not even involving virtual columns).
    
    A better way is to clear the dict_field_t::col pointers
    that point to virtual columns that are being freed
    due to aborting index creation on an index that depends
    on a virtual column.
    
    Note: the v_cols[] of an existing dict_table_t object will
    never be modified. If any virtual columns are added or removed,
    ha_innobase::commit_inplace_alter_table() would invoke
    dict_table_remove_from_cache() and reload the table to dict_sys.
    Index creation is a special case where the dict_index_t points
    to virtual columns that do not yet exist in dict_table_t.
    cb437417
handler0alter.cc 245 KB