[MDEV-18020] Failing assertion: !prebuilt->trx->check_foreigns and its variations upon mixing FULLTEXT and FOREIGN KEYs Created: 2018-12-16  Updated: 2019-04-23  Resolved: 2019-04-22

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Full-text Search, Storage Engine - InnoDB
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: Thirunarayanan Balathandayuthapani
Resolution: Duplicate Votes: 0
Labels: affects-tests

Issue Links:
Relates
relates to MDEV-18016 Assertion failure in dict_table_check... Closed
relates to MDEV-18017 Assertion `!index->to_be_dropped' or ... Closed

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (f VARCHAR(256), KEY(f)) ENGINE=InnoDB;
CREATE TABLE t2 (
  f1 VARCHAR(256),
  f2 VARCHAR(256),
  FULLTEXT (f2),
  FOREIGN KEY (f1) REFERENCES t1 (f)
) ENGINE=InnoDB;
ALTER TABLE t2 ADD FULLTEXT (f1);
 
# Cleanup
DROP TABLE t2, t1;

10.0 d1f399408

2018-12-19 23:37:24 7f9c9e95a700  InnoDB: Assertion failure in thread 140310652233472 in file handler0alter.cc line 6035
InnoDB: Failing assertion: !prebuilt->trx->check_foreigns
 
#5  0x00007f9c9cab73fa in abort () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00007f9c953562b7 in ha_innodb::commit_inplace_alter_table (this=0x7f9c8887e888, altered_table=0x7f9c88921070, ha_alter_info=0x7f9c9e957220, commit=true) at /data/src/10.0/storage/innobase/handler/handler0alter.cc:6035
#7  0x0000000000845595 in handler::ha_commit_inplace_alter_table (this=0x7f9c8887e888, altered_table=0x7f9c88921070, ha_alter_info=0x7f9c9e957220, commit=true) at /data/src/10.0/sql/handler.cc:4228
#8  0x0000000000703018 in mysql_inplace_alter_table (thd=0x7f9c90f69070, table_list=0x7f9c888f8178, table=0x7f9c8889f070, altered_table=0x7f9c88921070, ha_alter_info=0x7f9c9e957220, inplace_supported=HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE, target_mdl_request=0x7f9c9e956c70, alter_ctx=0x7f9c9e957800) at /data/src/10.0/sql/sql_table.cc:7176
#9  0x000000000070764e in mysql_alter_table (thd=0x7f9c90f69070, new_db=0x7f9c888f8758 "test", new_name=0x0, create_info=0x7f9c9e9584e0, table_list=0x7f9c888f8178, alter_info=0x7f9c9e958450, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:8982
#10 0x00000000007707c9 in Sql_cmd_alter_table::execute (this=0x7f9c888f8820, thd=0x7f9c90f69070) at /data/src/10.0/sql/sql_alter.cc:312
#11 0x000000000065537a in mysql_execute_command (thd=0x7f9c90f69070) at /data/src/10.0/sql/sql_parse.cc:5118
#12 0x00000000006589d0 in mysql_parse (thd=0x7f9c90f69070, rawbuf=0x7f9c888f8088 "ALTER TABLE t2 ADD FULLTEXT (f1)", length=32, parser_state=0x7f9c9e959640) at /data/src/10.0/sql/sql_parse.cc:6637
#13 0x000000000064b2f0 in dispatch_command (command=COM_QUERY, thd=0x7f9c90f69070, packet=0x7f9c96a30071 "ALTER TABLE t2 ADD FULLTEXT (f1)", packet_length=32) at /data/src/10.0/sql/sql_parse.cc:1300
#14 0x000000000064a5f0 in do_command (thd=0x7f9c90f69070) at /data/src/10.0/sql/sql_parse.cc:1003
#15 0x000000000076bf1c in do_handle_one_connection (thd_arg=0x7f9c90f69070) at /data/src/10.0/sql/sql_connect.cc:1377
#16 0x000000000076bc8e in handle_one_connection (arg=0x7f9c90f69070) at /data/src/10.0/sql/sql_connect.cc:1292
#17 0x0000000000acdb52 in pfs_spawn_thread (arg=0x7f9c90f19670) at /data/src/10.0/storage/perfschema/pfs.cc:1861
#18 0x00007f9c9e597494 in start_thread (arg=0x7f9c9e95a700) at pthread_create.c:333
#19 0x00007f9c9cb6b93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

10.2 0c2fc9b3d

2018-12-19 23:39:44 0x7f7f082de700  InnoDB: Assertion failure in file /data/src/10.2/storage/innobase/handler/handler0alter.cc line 8868
InnoDB: Failing assertion: !m_prebuilt->trx->check_foreigns
 
#5  0x00007f7f0fe7a3fa in abort () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00005574e1de4cda in ut_dbg_assertion_failed (expr=0x5574e2249cb0 "!m_prebuilt->trx->check_foreigns", file=0x5574e2247a40 "/data/src/10.2/storage/innobase/handler/handler0alter.cc", line=8868) at /data/src/10.2/storage/innobase/ut/ut0dbg.cc:60
#7  0x00005574e1c1a92f in ha_innobase::commit_inplace_alter_table (this=0x7f7eb41388b8, altered_table=0x7f7eb4049950, ha_alter_info=0x7f7f082da610, commit=true) at /data/src/10.2/storage/innobase/handler/handler0alter.cc:8868
#8  0x00005574e18ce3b1 in handler::ha_commit_inplace_alter_table (this=0x7f7eb41388b8, altered_table=0x7f7eb4049950, ha_alter_info=0x7f7f082da610, commit=true) at /data/src/10.2/sql/handler.cc:4231
#9  0x00005574e171c0b8 in mysql_inplace_alter_table (thd=0x7f7eb4000b00, table_list=0x7f7eb4012538, table=0x7f7eb4044d60, altered_table=0x7f7eb4049950, ha_alter_info=0x7f7f082da610, inplace_supported=HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE, target_mdl_request=0x7f7f082da680, alter_ctx=0x7f7f082db240) at /data/src/10.2/sql/sql_table.cc:7391
#10 0x00005574e17215f9 in mysql_alter_table (thd=0x7f7eb4000b00, new_db=0x7f7eb4012b48 "test", new_name=0x0, create_info=0x7f7f082dbe50, table_list=0x7f7eb4012538, alter_info=0x7f7f082dbda0, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9392
#11 0x00005574e179c95d in Sql_cmd_alter_table::execute (this=0x7f7eb4012c10, thd=0x7f7eb4000b00) at /data/src/10.2/sql/sql_alter.cc:329
#12 0x00005574e1653a45 in mysql_execute_command (thd=0x7f7eb4000b00) at /data/src/10.2/sql/sql_parse.cc:6227
#13 0x00005574e16588a7 in mysql_parse (thd=0x7f7eb4000b00, rawbuf=0x7f7eb4012448 "ALTER TABLE t2 ADD FULLTEXT (f1)", length=32, parser_state=0x7f7f082dd200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8014
#14 0x00005574e16461df in dispatch_command (command=COM_QUERY, thd=0x7f7eb4000b00, packet=0x7f7eb4096261 "ALTER TABLE t2 ADD FULLTEXT (f1)", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1825
#15 0x00005574e1644b42 in do_command (thd=0x7f7eb4000b00) at /data/src/10.2/sql/sql_parse.cc:1379
#16 0x00005574e17975f3 in do_handle_one_connection (connect=0x5574e5592df0) at /data/src/10.2/sql/sql_connect.cc:1335
#17 0x00005574e1797380 in handle_one_connection (arg=0x5574e5592df0) at /data/src/10.2/sql/sql_connect.cc:1241
#18 0x00005574e1bbd20c in pfs_spawn_thread (arg=0x5574e54d91f0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#19 0x00007f7f1192d494 in start_thread (arg=0x7f7f082de700) at pthread_create.c:333
#20 0x00007f7f0ff2e93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

10.3 b26736cdb1

2018-12-19 23:40:53 0x7f20c25af700  InnoDB: Assertion failure in file /data/src/10.3/storage/innobase/handler/handler0alter.cc line 9192
InnoDB: Failing assertion: !ctx->prebuilt->trx->check_foreigns
 
#6  0x0000563b12d283f7 in ut_dbg_assertion_failed (expr=0x563b1326d150 "!ctx->prebuilt->trx->check_foreigns", file=0x563b13269308 "/data/src/10.3/storage/innobase/handler/handler0alter.cc", line=9192) at /data/src/10.3/storage/innobase/ut/ut0dbg.cc:60
#7  0x0000563b12b4d2ec in commit_cache_norebuild (ha_alter_info=0x7f20c25ab360, ctx=0x7f207c016638, table=0x7f207c043150, trx=0x7f20c80831c8) at /data/src/10.3/storage/innobase/handler/handler0alter.cc:9192
#8  0x0000563b12b46586 in ha_innobase::commit_inplace_alter_table (this=0x7f207c043d98, altered_table=0x7f207c048480, ha_alter_info=0x7f20c25ab360, commit=true) at /data/src/10.3/storage/innobase/handler/handler0alter.cc:9868
#9  0x0000563b127e7bce in handler::ha_commit_inplace_alter_table (this=0x7f207c043d98, altered_table=0x7f207c048480, ha_alter_info=0x7f20c25ab360, commit=true) at /data/src/10.3/sql/handler.cc:4456
#10 0x0000563b125be814 in mysql_inplace_alter_table (thd=0x7f207c000b00, table_list=0x7f207c014dc8, table=0x7f207c043150, altered_table=0x7f207c048480, ha_alter_info=0x7f20c25ab360, inplace_supported=HA_ALTER_INPLACE_NOCOPY_LOCK, target_mdl_request=0x7f20c25ab490, alter_ctx=0x7f20c25ac090) at /data/src/10.3/sql/sql_table.cc:7598
#11 0x0000563b125c4698 in mysql_alter_table (thd=0x7f207c000b00, new_db=0x7f207c0051b8, new_name=0x7f207c005578, create_info=0x7f20c25acc80, table_list=0x7f207c014dc8, alter_info=0x7f20c25acbc0, order_num=0, order=0x0, ignore=false) at /data/src/10.3/sql/sql_table.cc:9700
#12 0x0000563b1264c525 in Sql_cmd_alter_table::execute (this=0x7f207c0154e0, thd=0x7f207c000b00) at /data/src/10.3/sql/sql_alter.cc:497
#13 0x0000563b124eddf9 in mysql_execute_command (thd=0x7f207c000b00) at /data/src/10.3/sql/sql_parse.cc:6285
#14 0x0000563b124f2ec9 in mysql_parse (thd=0x7f207c000b00, rawbuf=0x7f207c014cd8 "ALTER TABLE t2 ADD FULLTEXT (f1)", length=32, parser_state=0x7f20c25ae5f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8092
#15 0x0000563b124e007d in dispatch_command (command=COM_QUERY, thd=0x7f207c000b00, packet=0x7f207c00b1e1 "ALTER TABLE t2 ADD FULLTEXT (f1)", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1851
#16 0x0000563b124deaa1 in do_command (thd=0x7f207c000b00) at /data/src/10.3/sql/sql_parse.cc:1396
#17 0x0000563b12646ab0 in do_handle_one_connection (connect=0x563b15a32090) at /data/src/10.3/sql/sql_connect.cc:1402
#18 0x0000563b12646834 in handle_one_connection (arg=0x563b15a32090) at /data/src/10.3/sql/sql_connect.cc:1308
#19 0x0000563b12ae10c3 in pfs_spawn_thread (arg=0x563b15a73a30) at /data/src/10.3/storage/perfschema/pfs.cc:1862
#20 0x00007f20ced5b494 in start_thread (arg=0x7f20c25af700) at pthread_create.c:333
#21 0x00007f20cd35c93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Both debug and non-debug builds are affected.



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2019-04-22 ]

The above issue is already fixed by the following commit:

commit be25414828958d9cf829f7e8f162377bbfdfb4db
Author: Marko Mäkelä <marko.makela@mariadb.com>
Date:   Mon Feb 11 11:36:00 2019 +0200
 
    MDEV-18016: Cover the no-rebuild case, and remove a bogus debug assertion
 
    The code path where the table was not being rebuilt during ALTER TABLE
    was not covered by the test. Add coverage, and remove the debug assertion
    that could fail in this case.

So closing this issue as already fixed.

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