[MDEV-17004] Assertion failure in file ha_innodb.cc line 5833, innobase_get_fts_charset Created: 2018-08-16  Updated: 2022-09-08

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Storage Engine - XtraDB
Affects Version/s: 10.0, 10.1
Fix Version/s: 10.1

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Unresolved Votes: 0
Labels: None


 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (c CHAR(255), vc CHAR(255) AS (c) VIRTUAL) ENGINE=InnoDB;
ALTER TABLE t1 ADD FULLTEXT KEY(vc), LOCK=SHARED;
 
# Cleanup
DROP TABLE t1;

10.0 bcc677bb72

2018-08-16 18:33:18 7fcd0da3d700  InnoDB: Assertion failure in thread 140518673864448 in file ha_innodb.cc line 5833
InnoDB: We intentionally generate a memory trap.
 
#5  0x00007fcd0b97f3fa in abort () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00007fcd043432dd in innobase_get_fts_charset (mysql_type=3, charset_number=0) at /data/src/10.0/storage/innobase/handler/ha_innodb.cc:5833
#7  0x00007fcd04316b6e in fts_index_get_charset (index=0x7fccf7f98778) at /data/src/10.0/storage/innobase/fts/fts0fts.cc:984
#8  0x00007fcd04316c83 in fts_cache_index_cache_create (table=0x7fccf7f975f8, index=0x7fccf7f98778) at /data/src/10.0/storage/innobase/fts/fts0fts.cc:1041
#9  0x00007fcd042c68c8 in dict_index_build_internal_fts (table=0x7fccf7f975f8, index=0x7fccf7f984f8) at /data/src/10.0/storage/innobase/dict/dict0dict.cc:3241
#10 0x00007fcd042c4f50 in dict_index_add_to_cache (table=0x7fccf7f975f8, index=0x7fccf7f984f8, page_no=4294967295, strict=0) at /data/src/10.0/storage/innobase/dict/dict0dict.cc:2494
#11 0x00007fcd042b9cb3 in dict_create_index_step (thr=0x7fccf7d53b40) at /data/src/10.0/storage/innobase/dict/dict0crea.cc:1184
#12 0x00007fcd043f7ed5 in que_thr_step (thr=0x7fccf7d53b40) at /data/src/10.0/storage/innobase/que/que0que.cc:1089
#13 0x00007fcd043f8056 in que_run_threads_low (thr=0x7fccf7d53b40) at /data/src/10.0/storage/innobase/que/que0que.cc:1141
#14 0x00007fcd043f81e2 in que_run_threads (thr=0x7fccf7d53b40) at /data/src/10.0/storage/innobase/que/que0que.cc:1182
#15 0x00007fcd0442f11f in row_merge_create_index_graph (trx=0x7fccf7d52278, table=0x7fccf7f975f8, index=0x7fccf7f984f8) at /data/src/10.0/storage/innobase/row/row0merge.cc:3515
#16 0x00007fcd0442f261 in row_merge_create_index (trx=0x7fccf7d52278, table=0x7fccf7f975f8, index_def=0x7fccf7c2b818) at /data/src/10.0/storage/innobase/row/row0merge.cc:3561
#17 0x00007fcd04364068 in prepare_inplace_alter_table_dict (ha_alter_info=0x7fcd0da3a260, altered_table=0x7fccf7d15070, old_table=0x7fccf7c9e470, table_name=0x7fccf7c61175 "t1", flags=1, flags2=94, fts_doc_id_col=1, add_fts_doc_id=true, add_fts_doc_id_idx=true) at /data/src/10.0/storage/innobase/handler/handler0alter.cc:3043
#18 0x00007fcd04366f6f in ha_innodb::prepare_inplace_alter_table (this=0x7fccf7c7e888, altered_table=0x7fccf7d15070, ha_alter_info=0x7fcd0da3a260) at /data/src/10.0/storage/innobase/handler/handler0alter.cc:4041
#19 0x0000000000844267 in handler::ha_prepare_inplace_alter_table (this=0x7fccf7c7e888, altered_table=0x7fccf7d15070, ha_alter_info=0x7fcd0da3a260) at /data/src/10.0/sql/handler.cc:4208
#20 0x0000000000701fad in mysql_inplace_alter_table (thd=0x7fcd00691070, table_list=0x7fccf7cf8198, table=0x7fccf7c9e470, altered_table=0x7fccf7d15070, ha_alter_info=0x7fcd0da3a260, inplace_supported=HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE, target_mdl_request=0x7fcd0da39cb0, alter_ctx=0x7fcd0da3a840) at /data/src/10.0/sql/sql_table.cc:7114
#21 0x000000000070684d in mysql_alter_table (thd=0x7fcd00691070, new_db=0x7fccf7cf8778 "test", new_name=0x0, create_info=0x7fcd0da3b4e0, table_list=0x7fccf7cf8198, alter_info=0x7fcd0da3b450, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:8978
#22 0x000000000076f589 in Sql_cmd_alter_table::execute (this=0x7fccf7cf8848, thd=0x7fcd00691070) at /data/src/10.0/sql/sql_alter.cc:312
#23 0x000000000065470e in mysql_execute_command (thd=0x7fcd00691070) at /data/src/10.0/sql/sql_parse.cc:5118
#24 0x0000000000657d64 in mysql_parse (thd=0x7fcd00691070, rawbuf=0x7fccf7cf8088 "ALTER TABLE t1 ADD FULLTEXT KEY(vc), LOCK=SHARED", length=48, parser_state=0x7fcd0da3c640) at /data/src/10.0/sql/sql_parse.cc:6637
#25 0x000000000064a684 in dispatch_command (command=COM_QUERY, thd=0x7fcd00691070, packet=0x7fcd05995071 "ALTER TABLE t1 ADD FULLTEXT KEY(vc), LOCK=SHARED", packet_length=48) at /data/src/10.0/sql/sql_parse.cc:1300
#26 0x0000000000649984 in do_command (thd=0x7fcd00691070) at /data/src/10.0/sql/sql_parse.cc:1003
#27 0x000000000076acdc in do_handle_one_connection (thd_arg=0x7fcd00691070) at /data/src/10.0/sql/sql_connect.cc:1377
#28 0x000000000076aa4e in handle_one_connection (arg=0x7fcd00691070) at /data/src/10.0/sql/sql_connect.cc:1292
#29 0x0000000000accef0 in pfs_spawn_thread (arg=0x7fcd003f9670) at /data/src/10.0/storage/perfschema/pfs.cc:1861
#30 0x00007fcd0d67a494 in start_thread (arg=0x7fcd0da3d700) at pthread_create.c:333
#31 0x00007fcd0ba3393f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Reproducible on 10.0 and 10.1, debug and non-debug builds.
10.2 doesn't crash, it produces ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN which is probably expected.



 Comments   
Comment by Marko Mäkelä [ 2018-08-24 ]

I tried the following in 10.0. (In 10.2, the error was renamed to ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN.)

--source include/have_innodb.inc
--error ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN
CREATE TABLE t1 (
 c CHAR(255), vc CHAR(255) AS (c) VIRTUAL,
 FULLTEXT KEY(vc)) ENGINE=InnoDB;
CREATE TABLE t1 (c CHAR(255), vc CHAR(255) AS (c) VIRTUAL) ENGINE=InnoDB;
--error ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN
ALTER TABLE t1 ADD FULLTEXT KEY(vc), ALGORITHM=INPLACE;
--error ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN
ALTER TABLE t1 ADD FULLTEXT KEY(vc), ALGORITHM=COPY;
DROP TABLE t1;

The problem in 10.0 and 10.1 is that InnoDB is not at all aware of the virtual column vc. The CREATE TABLE would write messages to the server error log:

InnoDB: Error: no matching column for "vc" in index "vc" of table "test"."t1"!
2018-08-24 15:51:36 7fffe2f5b700 InnoDB: FTS Optimize Removing table test/t1

I believe that this has to be fixed in the SQL layer, outside InnoDB, possibly by backporting some code from 10.2.
Only starting with MDEV-5800 and the merge of InnoDB from MySQL 5.7, InnoDB knows about virtual columns (but does not support SPATIAL or FULLTEXT index on them).

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