[MDEV-30028] InnoDB: Failing assertion: result != FTS_INVALID with versioned table Created: 2022-11-17  Updated: 2023-10-20  Resolved: 2023-10-20

Status: Closed
Project: MariaDB Server
Component/s: Full-text Search, Versioned Tables
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.8.7, 10.9.5, 10.10.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Thirunarayanan Balathandayuthapani
Resolution: Duplicate Votes: 0
Labels: affects-tests

Issue Links:
Duplicate
duplicates MDEV-25004 Missing row in FTS_DOC_ID_INDEX durin... Closed
Relates
relates to MDEV-22676 InnoDB: Failing assertion: result != ... Open

 Description   

A similar failure MDEV-22676 was attributed to MDEV-371. This one does not use unique blobs and affects also 10.3.

--source include/have_innodb.inc
 
CREATE TABLE t (c CHAR(8), FULLTEXT INDEX ft(c)) ENGINE=InnoDB;
INSERT INTO t (c) VALUES ('x');
ALTER TABLE t ADD FTS_DOC_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;
ALTER TABLE t ADD SYSTEM VERSIONING;
REPLACE INTO t SELECT * FROM t;
ALTER IGNORE TABLE t FORCE, ALGORITHM=COPY;
 
# Cleanup
DROP TABLE t;

10.3 df4c3d96

2022-11-18 01:40:37 0x7f24deefb300  InnoDB: Assertion failure in file /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/fts/fts0fts.cc line 2199
InnoDB: Failing assertion: result != FTS_INVALID
 
#6  0x00005638d61e7205 in ut_dbg_assertion_failed (expr=0x5638d73d3300 "result != FTS_INVALID", file=0x5638d73d1740 "/home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/fts/fts0fts.cc", line=2199) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/ut/ut0dbg.cc:60
#7  0x00005638d648a7d6 in fts_trx_row_get_new_state (old_state=FTS_INSERT, event=FTS_INSERT) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/fts/fts0fts.cc:2199
#8  0x00005638d648b38c in fts_trx_table_add_op (ftt=0x61900012f948, doc_id=1, state=FTS_INSERT, fts_indexes=0x0) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/fts/fts0fts.cc:2387
#9  0x00005638d648b7b6 in fts_trx_add_op (trx=0x7f24ebb408b8, table=0x619000120d08, doc_id=1, state=FTS_INSERT, fts_indexes=0x0) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/fts/fts0fts.cc:2434
#10 0x00005638d60106c3 in row_insert_for_mysql (mysql_rec=0x61900012edb8 "\375x       \001", prebuilt=0x621000099d88, ins_mode=ROW_INS_NORMAL) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0mysql.cc:1494
#11 0x00005638d5cde051 in ha_innobase::write_row (this=0x61c0000d38a8, record=0x61900012edb8 "\375x       \001") at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/handler/ha_innodb.cc:8201
#12 0x00005638d5796b41 in handler::ha_write_row (this=0x61c0000d38a8, buf=0x61900012edb8 "\375x       \001") at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/handler.cc:6495
#13 0x00005638d526fd32 in copy_data_between_tables (thd=0x62a0000ba208, from=0x61f000047c88, to=0x61f000049888, create=..., ignore=true, order_num=0, order=0x0, copied=0x7f24deef5b40, deleted=0x7f24deef5b60, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7f24deef6830) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_table.cc:10833
#14 0x00005638d526b093 in mysql_alter_table (thd=0x62a0000ba208, new_db=0x62a0000be918, new_name=0x62a0000bed00, create_info=0x7f24deef7550, table_list=0x62b000000358, alter_info=0x7f24deef7450, order_num=0, order=0x0, ignore=true) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_table.cc:10262
#15 0x00005638d53d394c in Sql_cmd_alter_table::execute (this=0x62b000000a08, thd=0x62a0000ba208) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_alter.cc:512
#16 0x00005638d501f844 in mysql_execute_command (thd=0x62a0000ba208) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:6076
#17 0x00005638d502b676 in mysql_parse (thd=0x62a0000ba208, rawbuf=0x62b000000228 "ALTER IGNORE TABLE t FORCE, ALGORITHM=COPY", length=42, parser_state=0x7f24deef9950, is_com_multi=false, is_next_command=false) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:7855
#18 0x00005638d5002cc4 in dispatch_command (command=COM_QUERY, thd=0x62a0000ba208, packet=0x629000136209 "ALTER IGNORE TABLE t FORCE, ALGORITHM=COPY", packet_length=42, is_com_multi=false, is_next_command=false) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:1852
#19 0x00005638d4fff87c in do_command (thd=0x62a0000ba208) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:1398
#20 0x00005638d53c3236 in do_handle_one_connection (connect=0x608000000ea8) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1403
#21 0x00005638d53c2b32 in handle_one_connection (arg=0x608000000ea8) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1308
#22 0x00005638d696f88d in pfs_spawn_thread (arg=0x615000007608) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/perfschema/pfs.cc:1869
#23 0x00007f24f58dbea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#24 0x00007f24f57fbaef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Reproducible on all 10.3+, debug and non-debug.



 Comments   
Comment by Marko Mäkelä [ 2022-11-19 ]

I do not think it makes sense to analyze this before MDEV-25004 has been fixed.

Comment by Matthias Leich [ 2023-02-15 ]

Some alternative MTR test
 
--source include/have_innodb.inc
--disable_abort_on_error
 
CREATE TABLE t1 (
   col_primary_key INTEGER AUTO_INCREMENT,
   col_fulltext_key CHAR(255),
   PRIMARY KEY (col_primary_key),
   FULLTEXT KEY (col_fulltext_key))
ENGINE = InnoDB ;
INSERT INTO t1 (col_fulltext_key) VALUES ('on') ;
ALTER TABLE t1 ADD SYSTEM VERSIONING ;
 
let $OUTFILE=$MYSQLTEST_VARDIR/tmp/load_t1;
--replace_result $OUTFILE <outfile>
eval SELECT col_primary_key, col_fulltext_key INTO OUTFILE '$OUTFILE' FROM t1 ;
# When setting the SET AUTOCOMMIT to comment the crash disappears.
  SET AUTOCOMMIT = OFF ;
--replace_result $OUTFILE <outfile>
eval LOAD DATA INFILE '$OUTFILE' REPLACE INTO TABLE t1 ;
--replace_result $OUTFILE <outfile>
eval LOAD DATA INFILE '$OUTFILE' REPLACE INTO TABLE t1 ;
--remove_file $OUTFILE
 
DROP TABLE t1;

Comment by Marko Mäkelä [ 2023-10-20 ]

MDEV-25004 fixed this:

10.4 7d89dcf1ae6683b3b0dc28cbc7d54a47ef7137e9

CREATE TABLE t (c CHAR(8), FULLTEXT INDEX ft(c)) ENGINE=InnoDB;
INSERT INTO t (c) VALUES ('x');
ALTER TABLE t ADD FTS_DOC_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;
ALTER TABLE t ADD SYSTEM VERSIONING;
REPLACE INTO t SELECT * FROM t;
ALTER IGNORE TABLE t FORCE, ALGORITHM=COPY;
DROP TABLE t;
main.m 'innodb'                          [ pass ]  12545

10.3 72e2d1d2201c2da23777d8fb89e078475e0c1371

main.m 'innodb'                          [ pass ]   1206

10.3 7c5609fb647b7b013694a16acae7c5c5739b394b

mysqltest: At line 8: query 'ALTER IGNORE TABLE t FORCE, ALGORITHM=COPY' failed: 2013: Lost connection to MySQL server during query
Version: '10.3.38-MariaDB-debug-log'  socket: '/dev/shm/10.4/mysql-test/var/tmp/mysqld.1.sock'  port: 16000  Source distribution
2023-10-20 15:14:22 0x7f59781ae6c0  InnoDB: Assertion failure in file /mariadb/10.4/storage/innobase/fts/fts0fts.cc line 2199
InnoDB: Failing assertion: result != FTS_INVALID
#0  __pthread_kill_implementation (threadid=..., signo=..., no_tid=...) at ./nptl/pthread_kill.c:44
#1  0x00007f5987ea815f in __pthread_kill_internal (signo=..., threadid=...) at ./nptl/pthread_kill.c:78
#2  0x00007f5987e5a472 in __GI_raise (sig=...) at ../sysdeps/posix/raise.c:26
#3  0x00007f5987e444b2 in __GI_abort () at ./stdlib/abort.c:79
#4  0x0000564c1097a1a2 in ut_dbg_assertion_failed (expr=..., file=..., line=...) at /mariadb/10.4/storage/innobase/ut/ut0dbg.cc:60
#5  0x0000564c105b7b13 in fts_trx_row_get_new_state (event=..., old_state=...) at /mariadb/10.4/storage/innobase/fts/fts0fts.cc:2199
#6  fts_trx_table_add_op (ftt=..., doc_id=..., state=..., fts_indexes=...) at /mariadb/10.4/storage/innobase/fts/fts0fts.cc:2387
#7  0x0000564c105b7791 in fts_trx_add_op (trx=..., table=..., doc_id=..., state=..., fts_indexes=...)
    at /mariadb/10.4/storage/innobase/fts/fts0fts.cc:2434
#8  0x0000564c10893ca3 in row_insert_for_mysql (mysql_rec=..., prebuilt=..., ins_mode=...)
    at /mariadb/10.4/storage/innobase/row/row0mysql.cc:1494
#9  0x0000564c10581950 in ha_innobase::write_row (this=..., record=...) at /mariadb/10.4/storage/innobase/handler/ha_innodb.cc:8196
#10 0x0000564c100e4300 in handler::ha_write_row (this=..., buf=...) at /mariadb/10.4/sql/handler.cc:6495
#11 0x0000564c103f1604 in copy_data_between_tables (thd=..., from=..., to=..., create=..., ignore=..., order_num=..., order=..., copied=..., 
    deleted=..., keys_onoff=..., alter_ctx=...) at /mariadb/10.4/sql/sql_table.cc:10839
#12 0x0000564c103ec3ef in mysql_alter_table (thd=..., new_db=..., new_name=..., create_info=..., table_list=..., alter_info=..., 
    order_num=..., order=..., ignore=...) at /mariadb/10.4/sql/sql_table.cc:10268

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