[MDEV-28060] Online DDL fails while checking for instant alter condition Created: 2022-03-14  Updated: 2022-03-15  Resolved: 2022-03-15

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4, 10.5, 10.6, 10.7
Fix Version/s: 10.4.25, 10.5.16, 10.6.8, 10.7.4

Type: Bug Priority: Major
Reporter: Thirunarayanan Balathandayuthapani Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-18035 InnoDB: Failing assertion: field->col... Closed
Relates
relates to MDEV-15563 Instant failure-free data type conver... Closed

 Description   

InnoDB fails to skip newly created column while checking for change column. This problem
is getting only in redundant row format tables.

                Field** af = altered_table->field;
                Field** const end = altered_table->field
                        + altered_table->s->fields;
                for (unsigned c = 0; af < end; af++) {
                        if (!(*af)->stored_in_db()) {
                                continue;
                        }
 
                        const dict_col_t* col = dict_table_get_nth_col(
                                &ib_table, c++);

Test case:

--source include/have_innodb.inc
create table t1(f1 char(10) not null) row_format=redundant, engine=innodb;
 
alter table t1 ADD COLUMN ( tscol5 DATETIME NOT NULL, tcol1 TIME NOT NULL DEFAULT 0, ecol6 SET('foo','bar') DEFAULT NULL ), ADD COLUMN IF NOT EXISTS ( scol8 VARBINARY(100) DEFAULT NULL ), change column f1 f1 char(10) default null, LOCK=SHARED;
 
drop table t1;

Stack trace is

mariadbd: /home/thiru/mariarepo/10.6/10.6-test/storage/innobase/include/dict0dict.inl:370: dict_col_t* dict_table_get_nth_col(const dict_table_t*, ulint): Assertion `pos < table->n_def' failed.
 
include/dict0dict.inl:371(dict_table_get_nth_col(dict_table_t const*, unsigned long))[0x56543fbb129b]
handler/handler0alter.cc:1768(instant_alter_column_possible(dict_table_t const&, Alter_inplace_info const*, TABLE const*, TABLE const*, bool))[0x56543fbb5b9d]
handler/handler0alter.cc:2453(ha_innobase::check_if_supported_inplace_alter(TABLE*, Alter_inplace_info*))[0x56543fbb7c9e]
sql/sql_table.cc:10220(mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool, bool))[0x56543f4ea25e]
sql/sql_alter.cc:542(Sql_cmd_alter_table::execute(THD*))[0x56543f59d444]
sql/sql_parse.cc:5996(mysql_execute_command(THD*, bool))[0x56543f3e930f]
sql/sql_parse.cc:8029(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x56543f3ef3aa]



 Comments   
Comment by Marko Mäkelä [ 2022-03-14 ]

Thank you for debugging this. The fix looks OK to me. This affects the removal of NOT NULL attribute of a column in ROW_FORMAT=REDUNDANT tables (MDEV-15563).

Generated at Thu Feb 08 09:57:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.