[MDEV-30455] Assertion result != FTS_INVALID in fts_trx_row_get_new_state() Created: 2023-01-24  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Full-text Search, Storage Engine - InnoDB
Affects Version/s: 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.6, 10.11

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


 Description   

Replace command for fts system versioning table causes the assert failure.

Below is the stack trace:

#2  0x000055555693f31d in ut_dbg_assertion_failed (expr=0x5555571e48ac "result != FTS_INVALID", file=0x5555571e3f28 "/home/thiru/mariarepo/server/10.7/storage/innobase/fts/fts0fts.cc", line=2177) at /home/thiru/mariarepo/server/10.7/storage/innobase/ut/ut0dbg.cc:60
#3  0x0000555556a680c7 in fts_trx_row_get_new_state (old_state=FTS_DELETE, event=FTS_DELETE) at /home/thiru/mariarepo/server/10.7/storage/innobase/fts/fts0fts.cc:2177
#4  0x0000555556a68507 in fts_trx_table_add_op (ftt=0x7fff94133448, doc_id=1, state=FTS_DELETE, fts_indexes=0x0) at /home/thiru/mariarepo/server/10.7/storage/innobase/fts/fts0fts.cc:2365
#5  0x0000555556a68681 in fts_trx_add_op (trx=0x7ffff0956b80, table=0x7fff9407b258, doc_id=1, state=FTS_DELETE, fts_indexes=0x0) at /home/thiru/mariarepo/server/10.7/storage/innobase/fts/fts0fts.cc:2412
#6  0x00005555568891b8 in row_fts_update_or_delete (prebuilt=0x7fff94231c28) at /home/thiru/mariarepo/server/10.7/storage/innobase/row/row0mysql.cc:1551
#7  0x0000555556889afb in row_update_for_mysql (prebuilt=0x7fff94231c28) at /home/thiru/mariarepo/server/10.7/storage/innobase/row/row0mysql.cc:1713
#8  0x00005555566cc7d2 in ha_innobase::update_row (this=0x7fff94046980, old_row=0x7fff94230590 "\245\001", new_row=0x7fff94230478 "\375\001") at /home/thiru/mariarepo/server/10.7/storage/innobase/handler/ha_innodb.cc:8643
#9  0x00005555562fbe30 in handler::ha_update_row (this=0x7fff94046980, old_data=0x7fff94230590 "\245\001", new_data=0x7fff94230478 "\375\001") at /home/thiru/mariarepo/server/10.7/sql/handler.cc:7639
#10 0x0000555555eed9d7 in write_record (thd=0x7fff94000d78, table=0x7fff94236c68, info=0x7fffeb667b30, sink=0x0) at /home/thiru/mariarepo/server/10.7/sql/sql_insert.cc:2107
#11 0x0000555555eeaa45 in mysql_insert (thd=0x7fff94000d78, table_list=0x7fff940154e0, fields=@0x7fff94006070: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x555557be71e0 <end_of_list>, last = 0x7fff94006070, elements = 0}, <No data fields>}, values_list=@0x7fff940060b8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7fff940161a8, last = 0x7fff940161a8, elements = 1}, <No data fields>}, update_fields=@0x7fff940060a0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x555557be71e0 <end_of_list>, last = 0x7fff940060a0, elements = 0}, <No data fields>}, update_values=@0x7fff94006088: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x555557be71e0 <end_of_list>, last = 0x7fff94006088, elements = 0}, <No data fields>}, duplic=DUP_REPLACE, ignore=false, result=0x0) at /home/thiru/mariarepo/server/10.7/sql/sql_insert.cc:1146
#12 0x0000555555f3ea3c in mysql_execute_command (thd=0x7fff94000d78, is_called_from_prepared_stmt=false) at /home/thiru/mariarepo/server/10.7/sql/sql_parse.cc:4566
#13 0x0000555555f4a464 in mysql_parse (thd=0x7fff94000d78, rawbuf=0x7fff94015400 "replace into t1 values(1, 'on')", length=31, parser_state=0x7fffeb6683a0) at /home/thiru/mariarepo/server/10.7/sql/sql_parse.cc:8017

Test case to repeat the scenario:

--source include/have_innodb.inc
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 VALUES (1, 'on') ;
ALTER TABLE t1 ADD SYSTEM VERSIONING ;
begin;
replace into t1 values(1, 'on');
replace into t1 values(1, 'on');
commit;
select * from t1;
DROP TABLE t1;



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

I checked that this bug had been filed after MDEV-25004 was merged to 10.6 and is still reproducible:

10.6 6991b1c47c23c0b085f6af8a2879ea44baf62958

mysqltest: At line 12: query 'replace into t1 values(1, 'on')' failed: <Unknown> (2013): Lost connection to server during query
2023-10-20 15:22:47 0x7f3ea80f06c0  InnoDB: Assertion failure in file /mariadb/10.6/storage/innobase/fts/fts0fts.cc line 2185
InnoDB: Failing assertion: result != FTS_INVALID

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