• Jan Lindström's avatar
    MDEV-13838: Wrong result after altering a partitioned table · fc9ff695
    Jan Lindström authored
    Reverted incorrect changes done on MDEV-7367 and MDEV-9469. Fixes properly
    also related bugs:
    
    MDEV-13668: InnoDB unnecessarily rebuilds table when renaming a column and adding index
    MDEV-9469: 'Incorrect key file' on ALTER TABLE
    MDEV-9548: Alter table (renaming and adding index) fails with "Incorrect key file for table"
    MDEV-10535: ALTER TABLE causes standalone/wsrep cluster crash
    MDEV-13640: ALTER TABLE CHANGE and ADD INDEX on auto_increment column fails with "Incorrect key file for table..."
    
    Root cause for all these bugs is the fact that MariaDB .frm file
    can contain virtual columns but InnoDB dictionary does not and
    previous fixes were incorrect or unnecessarily forced table
    rebuilt. In index creation key_part->fieldnr can be bigger than
    number of columns in InnoDB data dictionary. We need to skip not
    stored fields when calculating correct column number for InnoDB
    data dictionary.
    
    dict_table_get_col_name_for_mysql
            Remove
    
    innobase_match_index_columns
            Revert incorrect change done on MDEV-7367
    
    innobase_need_rebuild
            Remove unnecessary rebuild force when column is renamed.
    
    innobase_create_index_field_def
            Calculate InnoDB column number correctly and remove
            unnecessary column name set.
    
    innobase_create_index_def, innobase_create_key_defs
            Remove unneeded fields parameter. Revert unneeded memset.
    
    prepare_inplace_alter_table_dict
            Remove unneeded col_names parameter
    
    index_field_t
            Remove unneeded col_name member.
    
    row_merge_create_index
            Remove unneeded col_names parameter and resolution.
    
    Effected tests:
             innodb-alter-table : Add test case for MDEV-13668
             innodb-alter : Remove MDEV-13668, MDEV-9469 FIXMEs
                            and restore original tests
             innodb-wl5980-alter : Remove MDEV-13668,  MDEV-9469 FIXMEs
                            and restore original tests
    fc9ff695
innodb-alter.test 15.6 KB