[MDEV-18579] Assertion `!ctx->online || num_fts_index == 0' failed in prepare_inplace_alter_table_dict Created: 2019-02-14  Updated: 2019-02-15  Resolved: 2019-02-15

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4.3
Fix Version/s: 10.4.3

Type: Bug Priority: Major
Reporter: Matthias Leich Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None
Environment:

Ubuntu 17.10



 Description   

Problem found during RQG testing

10.4 commit 0f489494395a8cd6aeaf5943fea63a9e4465cabb Wed Feb 13 19:39:41
 
--source include/have_innodb.inc
--disable_abort_on_error
# harmless CREATE TABLE t4 ( col1 INT, col_text TEXT, FULLTEXT INDEX ( col_text ) ) ENGINE = InnoDB ;
CREATE TABLE t4 ( col1 INT, col_text TEXT, FULLTEXT INDEX ( col_text ) ) ENGINE = InnoDB ROW_FORMAT = Redundant ;
ALTER TABLE t4 MODIFY COLUMN col_text TEXT NOT NULL ;
ALTER TABLE t4 MODIFY COLUMN col_text TEXT;
 
DROP TABLE t4;
 
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
CREATE TABLE t4 ( col1 INT, col_text TEXT, FULLTEXT INDEX ( col_text ) ) ENGINE = InnoDB ROW_FORMAT = Redundant ;
ALTER TABLE t4 MODIFY COLUMN col_text TEXT NOT NULL ;
ALTER TABLE t4 MODIFY COLUMN col_text TEXT;
ERROR HY000: Lost connection to MySQL server during query
DROP TABLE t4;
ERROR HY000: MySQL server has gone away
...
mysqld: storage/innobase/handler/handler0alter.cc:6552: bool prepare_inplace_alter_table_dict(Alter_inplace_info*, const TABLE*, const TABLE*, const char*, ulint, ulint, ulint, bool, bool): Assertion `!ctx->online || num_fts_index == 0' failed.
190214 16:09:55 [ERROR] mysqld got signal 6 ;
...
Query (0x7fa06c014470): ALTER TABLE t4 MODIFY COLUMN col_text TEXT
Connection ID (thread ID): 9
Status: NOT_KILLED
...
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007fa0c722af5d in __GI_abort () at abort.c:90
#6  0x00007fa0c7220f17 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x564524165728 "!ctx->online || num_fts_index == 0", file=file@entry=0x564524162140 "storage/innobase/handler/handler0alter.cc", line=line@entry=6552, function=function@entry=0x56452416a500 <prepare_inplace_alter_table_dict(Alter_inplace_info*, TABLE const*, TABLE const*, char const*, unsigned long, unsigned long, unsigned long, bool, bool)::__PRETTY_FUNCTION__> "bool prepare_inplace_alter_table_dict(Alter_inplace_info*, const TABLE*, const TABLE*, const char*, ulint, ulint, ulint, bool, bool)") at assert.c:92
#7  0x00007fa0c7220fc2 in __GI___assert_fail (assertion=0x564524165728 "!ctx->online || num_fts_index == 0", file=0x564524162140 "storage/innobase/handler/handler0alter.cc", line=6552, function=0x56452416a500 <prepare_inplace_alter_table_dict(Alter_inplace_info*, TABLE const*, TABLE const*, char const*, unsigned long, unsigned long, unsigned long, bool, bool)::__PRETTY_FUNCTION__> "bool prepare_inplace_alter_table_dict(Alter_inplace_info*, const TABLE*, const TABLE*, const char*, ulint, ulint, ulint, bool, bool)") at assert.c:101
#8  0x00005645238f6f30 in prepare_inplace_alter_table_dict (ha_alter_info=0x7fa0c0543ad0, altered_table=0x7fa06c16a498, old_table=0x7fa06c1293d8, table_name=0x7fa06c040fb5 "t4", flags=0, flags2=94, fts_doc_id_col=2, add_fts_doc_id=true, add_fts_doc_id_idx=true) at storage/innobase/handler/handler0alter.cc:6552
#9  0x00005645238fbcc9 in ha_innobase::prepare_inplace_alter_table (this=0x7fa06c1288c0, altered_table=0x7fa06c16a498, ha_alter_info=0x7fa0c0543ad0) at storage/innobase/handler/handler0alter.cc:8091
#10 0x00005645236a3d1d in handler::ha_prepare_inplace_alter_table (this=0x7fa06c1288c0, altered_table=0x7fa06c16a498, ha_alter_info=0x7fa0c0543ad0) at sql/handler.cc:4649
#11 0x0000564523433a5a in mysql_inplace_alter_table (thd=0x7fa06c000ce8, table_list=0x7fa06c014578, table=0x7fa06c1293d8, altered_table=0x7fa06c16a498, ha_alter_info=0x7fa0c0543ad0, inplace_supported=HA_ALTER_INPLACE_INSTANT, target_mdl_request=0x7fa0c0543d00, alter_ctx=0x7fa0c05442b0) at sql/sql_table.cc:7530
#12 0x0000564523439c9e in mysql_alter_table (thd=0x7fa06c000ce8, new_db=0x7fa06c0053b8, new_name=0x7fa06c005788, create_info=0x7fa0c0544ea0, table_list=0x7fa06c014578, alter_info=0x7fa0c0544de0, order_num=0, order=0x0, ignore=false) at sql/sql_table.cc:9713
#13 0x00005645234c4d1f in Sql_cmd_alter_table::execute (this=0x7fa06c014cb0, thd=0x7fa06c000ce8) at sql/sql_alter.cc:493
#14 0x000056452335eaee in mysql_execute_command (thd=0x7fa06c000ce8) at sql/sql_parse.cc:6318
#15 0x0000564523363f3c in mysql_parse (thd=0x7fa06c000ce8, rawbuf=0x7fa06c014470 "ALTER TABLE t4 MODIFY COLUMN col_text TEXT", length=42, parser_state=0x7fa0c0546200, is_com_multi=false, is_next_command=false) at sql/sql_parse.cc:8129
#16 0x000056452334f360 in dispatch_command (command=COM_QUERY, thd=0x7fa06c000ce8, packet=0x7fa06c009ed9 "ALTER TABLE t4 MODIFY COLUMN col_text TEXT", packet_length=42, is_com_multi=false, is_next_command=false) at sql/sql_parse.cc:1807
#17 0x000056452334dc5c in do_command (thd=0x7fa06c000ce8) at sql/sql_parse.cc:1357
#18 0x00005645234bec5e in do_handle_one_connection (connect=0x5645278c68f8) at sql/sql_connect.cc:1399
#19 0x00005645234be9c2 in handle_one_connection (arg=0x5645278c68f8) at sql/sql_connect.cc:1302
#20 0x0000564523dec62a in pfs_spawn_thread (arg=0x56452790caf8) at storage/perfschema/pfs.cc:1862
#21 0x00007fa0c80d07fc in start_thread (arg=0x7fa0c0547700) at pthread_create.c:465
#22 0x00007fa0c7306b5f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
 
The problem was introduced by
10.4 commit 9f56dd738235dc21204fb60a307b8681e6677ba7
Merge: 3a269a8b527 4e7ee166a9c
Date:   Mon Feb 11 17:55:25
 
10.3.13  commit e8b6c15010e6fffe17e27c165b8c60b51a8f66a7 Wed Feb 13 23:26:23 2019
do not show this problem.



 Comments   
Comment by Matthias Leich [ 2019-02-15 ]

I guess a sibling of this problem is
--source include/have_innodb.inc
--disable_abort_on_error
 
# Harmless CREATE TABLE t4 ( col1 INT, col_text TEXT NOT NULL, FULLTEXT INDEX ( col_text ) ) ENGINE = InnoDB ;
CREATE TABLE t4 ( col1 INT, col_text TEXT NOT NULL, FULLTEXT INDEX ( col_text ) ) ENGINE = InnoDB ROW_FORMAT = Redundant ;
# Disabling the next leads to "!ctx->online || num_fts_index == 0" https://jira.mariadb.org/browse/MDEV-18579
ALTER TABLE t4 ADD FULLTEXT INDEX ( col_text ) ;
ALTER TABLE t4 MODIFY COLUMN col_text TEXT;
 
DROP TABLE t4;
 
...
Version: '10.4.3-MariaDB-debug-log'  socket: ...
mysqld: storage/innobase/handler/handler0alter.cc:6551: bool prepare_inplace_alter_table_dict(Alter_inplace_info*, const TABLE*, const TABLE*, const char*, ulint, ulint, ulint, bool, bool): Assertion `num_fts_index <= 1' failed.
190215 12:08:35 [ERROR] mysqld got signal 6 ;
...
Query (0x7f3fbc014470): ALTER TABLE t4 MODIFY COLUMN col_text TEXT
Connection ID (thread ID): 9
Status: NOT_KILLED

Comment by Marko Mäkelä [ 2019-02-15 ]

A condition for working around MDEV-17459 in instant_alter_column_possible() was relaxed in a recent merge from 10.3. One caller had another similar condition, which is now correctly pushed down to avoid a mismatch between ha_innobase::check_if_supported_inplace_alter() and ha_innobase::prepare_inplace_alter_table().

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