[MDEV-18321] Server crash or Failing assertion: 0 in ha_innodb::commit_inplace_alter_table upon adding virtual column Created: 2019-01-21  Updated: 2020-06-25  Resolved: 2019-04-18

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Storage Engine - InnoDB, Virtual Columns
Affects Version/s: 10.0, 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.4.3, 10.1.38, 10.0.38, 10.2.22, 10.3.13

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-18016 Assertion failure in dict_table_check... Closed
Relates
relates to MDEV-16654 InnoDB: dict_load_foreigns() returned... Closed
relates to MDEV-19621 Server crashes in ha_innobase::commit... Closed

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (a INT, KEY(a), UNIQUE(a), FOREIGN KEY (a) REFERENCES t1 (a)) ENGINE=InnoDB;
ALTER TABLE t1 DROP INDEX a;
ALTER TABLE t1 ADD COLUMN v INT AS (a);
 
# Cleanup
DROP TABLE t1;

10.0 debug 2061e00c200c

190121 13:42:46 [ERROR] InnoDB: dict_load_foreigns() returned 38 for ALTER TABLE t1 ADD COLUMN v INT AS (a)
2019-01-21 13:42:46 7f046ac99700  InnoDB: Assertion failure in thread 139656948193024 in file handler0alter.cc line 6035
InnoDB: Failing assertion: 0
 
#5  0x00007f0468bdc3fa in abort () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00007f0461369502 in ha_innodb::commit_inplace_alter_table (this=0x7f0454480088, altered_table=0x7f045479f070, ha_alter_info=0x7f046ac96220, commit=true) at /data/src/10.0/storage/innobase/handler/handler0alter.cc:6035
#7  0x000000000084512d in handler::ha_commit_inplace_alter_table (this=0x7f0454480088, altered_table=0x7f045479f070, ha_alter_info=0x7f046ac96220, commit=true) at /data/src/10.0/sql/handler.cc:4228
#8  0x00000000007029c6 in mysql_inplace_alter_table (thd=0x7f045cf69070, table_list=0x7f04544f8180, table=0x7f045449e470, altered_table=0x7f045479f070, ha_alter_info=0x7f046ac96220, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7f046ac95c70, alter_ctx=0x7f046ac96800) at /data/src/10.0/sql/sql_table.cc:7176
#9  0x0000000000706ffc in mysql_alter_table (thd=0x7f045cf69070, new_db=0x7f04544f8760 "test", new_name=0x0, create_info=0x7f046ac974e0, table_list=0x7f04544f8180, alter_info=0x7f046ac97450, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:8982
#10 0x0000000000770361 in Sql_cmd_alter_table::execute (this=0x7f04544f8980, thd=0x7f045cf69070) at /data/src/10.0/sql/sql_alter.cc:312
#11 0x0000000000654d27 in mysql_execute_command (thd=0x7f045cf69070) at /data/src/10.0/sql/sql_parse.cc:5125
#12 0x000000000065837e in mysql_parse (thd=0x7f045cf69070, rawbuf=0x7f04544f8088 "ALTER TABLE t1 ADD COLUMN v INT AS (a)", length=38, parser_state=0x7f046ac98640) at /data/src/10.0/sql/sql_parse.cc:6644
#13 0x000000000064ac38 in dispatch_command (command=COM_QUERY, thd=0x7f045cf69070, packet=0x7f0462a30071 "ALTER TABLE t1 ADD COLUMN v INT AS (a)", packet_length=38) at /data/src/10.0/sql/sql_parse.cc:1301
#14 0x0000000000649f2c in do_command (thd=0x7f045cf69070) at /data/src/10.0/sql/sql_parse.cc:1003
#15 0x000000000076bab4 in do_handle_one_connection (thd_arg=0x7f045cf69070) at /data/src/10.0/sql/sql_connect.cc:1377
#16 0x000000000076b826 in handle_one_connection (arg=0x7f045cf69070) at /data/src/10.0/sql/sql_connect.cc:1292
#17 0x0000000000acd6fc in pfs_spawn_thread (arg=0x7f045cf19670) at /data/src/10.0/storage/perfschema/pfs.cc:1861
#18 0x00007f046a8d7494 in start_thread (arg=0x7f046ac99700) at pthread_create.c:333
#19 0x00007f0468c9093f in clone () from /lib/x86_64-linux-gnu/libc.so.6

10.0 non-debug 2061e00c200c

mysqltest: At line 5: query 'ALTER TABLE t1 ADD COLUMN v INT AS (a)' failed: 1215: Cannot add foreign key constraint

10.1 is the same as 10.0.

10.2 debug, non-debug 37ffdb44ef96

2019-01-21 13:45:18 140628642801408 [Warning] InnoDB: Load table `test`.`t1` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again.
190121 13:45:18 [ERROR] mysqld got signal 11 ;
 
#3  <signal handler called>
#4  0x000055c3eb54695a in ha_innobase::commit_inplace_alter_table (this=0x7fe650035908, altered_table=0x7fe65003ee80, ha_alter_info=0x7fe6a84c6610, commit=true) at /data/src/10.2/storage/innobase/handler/handler0alter.cc:8971
#5  0x000055c3eb1f9fc5 in handler::ha_commit_inplace_alter_table (this=0x7fe650035908, altered_table=0x7fe65003ee80, ha_alter_info=0x7fe6a84c6610, commit=true) at /data/src/10.2/sql/handler.cc:4231
#6  0x000055c3eb047c88 in mysql_inplace_alter_table (thd=0x7fe650000b00, table_list=0x7fe650012540, table=0x7fe650034d00, altered_table=0x7fe65003ee80, ha_alter_info=0x7fe6a84c6610, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7fe6a84c6680, alter_ctx=0x7fe6a84c7240) at /data/src/10.2/sql/sql_table.cc:7391
#7  0x000055c3eb04d1c9 in mysql_alter_table (thd=0x7fe650000b00, new_db=0x7fe650012b50 "test", new_name=0x0, create_info=0x7fe6a84c7e50, table_list=0x7fe650012540, alter_info=0x7fe6a84c7da0, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9392
#8  0x000055c3eb0c852d in Sql_cmd_alter_table::execute (this=0x7fe650012d70, thd=0x7fe650000b00) at /data/src/10.2/sql/sql_alter.cc:329
#9  0x000055c3eaf7f240 in mysql_execute_command (thd=0x7fe650000b00) at /data/src/10.2/sql/sql_parse.cc:6228
#10 0x000055c3eaf840a1 in mysql_parse (thd=0x7fe650000b00, rawbuf=0x7fe650012448 "ALTER TABLE t1 ADD COLUMN v INT AS (a)", length=38, parser_state=0x7fe6a84c9200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8015
#11 0x000055c3eaf719db in dispatch_command (command=COM_QUERY, thd=0x7fe650000b00, packet=0x7fe650096051 "ALTER TABLE t1 ADD COLUMN v INT AS (a)", packet_length=38, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1826
#12 0x000055c3eaf70332 in do_command (thd=0x7fe650000b00) at /data/src/10.2/sql/sql_parse.cc:1379
#13 0x000055c3eb0c31c3 in do_handle_one_connection (connect=0x55c3ede11bd0) at /data/src/10.2/sql/sql_connect.cc:1335
#14 0x000055c3eb0c2f50 in handle_one_connection (arg=0x55c3ede11bd0) at /data/src/10.2/sql/sql_connect.cc:1241
#15 0x000055c3eb4e8e72 in pfs_spawn_thread (arg=0x55c3edd57fd0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#16 0x00007fe6b0d32494 in start_thread (arg=0x7fe6a84ca700) at pthread_create.c:333
#17 0x00007fe6af11893f in clone () from /lib/x86_64-linux-gnu/libc.so.6

==23319==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x55ed463caabc sp 0x7fc59f1bb940 bp 0x7fc59f1bcd00 T27)
    #0 0x55ed463caabb in ha_innobase::commit_inplace_alter_table(TABLE*, Alter_inplace_info*, bool) /data/src/10.2/storage/innobase/handler/handler0alter.cc:8971
    #1 0x55ed45bb0b0d in handler::ha_commit_inplace_alter_table(TABLE*, Alter_inplace_info*, bool) /data/src/10.2/sql/handler.cc:4231
    #2 0x55ed457b67a6 in mysql_inplace_alter_table /data/src/10.2/sql/sql_table.cc:7391
    #3 0x55ed457c2fca in mysql_alter_table(THD*, char*, char*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool) /data/src/10.2/sql/sql_table.cc:9392
    #4 0x55ed458eed16 in Sql_cmd_alter_table::execute(THD*) /data/src/10.2/sql/sql_alter.cc:329
    #5 0x55ed455b7eb5 in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:6228
    #6 0x55ed455c29eb in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:8015
    #7 0x55ed4559d3d8 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1826
    #8 0x55ed4559a46d in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1379
    #9 0x55ed458e088c in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1335
    #10 0x55ed458e02a1 in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #11 0x55ed462fb511 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1862
    #12 0x7fc5afbb2493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
    #13 0x7fc5adf9893e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
 
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /data/src/10.2/storage/innobase/handler/handler0alter.cc:8971 ha_innobase::commit_inplace_alter_table(TABLE*, Alter_inplace_info*, bool)
Thread T27 created by T0 here:
    #0 0x7fc5afdebbba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
    #1 0x55ed462fbad9 in spawn_thread_v1 /data/src/10.2/storage/perfschema/pfs.cc:1912
    #2 0x55ed45396c8e in inline_mysql_thread_create /data/src/10.2/include/mysql/psi/mysql_thread.h:1239
    #3 0x55ed453abc2b in create_thread_to_handle_connection(CONNECT*) /data/src/10.2/sql/mysqld.cc:6466
    #4 0x55ed453ac330 in create_new_thread /data/src/10.2/sql/mysqld.cc:6536
    #5 0x55ed453ad347 in handle_connections_sockets() /data/src/10.2/sql/mysqld.cc:6811
    #6 0x55ed453ab180 in mysqld_main(int, char**) /data/src/10.2/sql/mysqld.cc:6085
    #7 0x55ed4539502f in main /data/src/10.2/sql/main.cc:25
    #8 0x7fc5aded02b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
 
==23319==ABORTING

Similar on 10.3, 10.4.



 Comments   
Comment by Marko Mäkelä [ 2019-04-18 ]

I can repeat this with the parent of the commit that fixed MDEV-18016 but not when that fix is present.

Comment by Alice Sherepa [ 2020-06-25 ]

Test does not fail on current 10.0, but SEGV on 10.2-10.5.

Generated at Thu Feb 08 08:43:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.