[MDEV-22676] InnoDB: Failing assertion: result != FTS_INVALID upon DML on table with unique blob Created: 2020-05-22  Updated: 2023-03-03

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

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-371 Unique indexes for blobs Closed
Relates
relates to MDEV-23722 InnoDB: Failing assertion: result != ... Closed
relates to MDEV-30028 InnoDB: Failing assertion: result != ... Closed

 Description   

--source include/have_innodb.inc
 
CREATE OR REPLACE TABLE t1 (f TEXT UNIQUE, FULLTEXT(f)) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('foo');
 
CREATE OR REPLACE TABLE t2 (a VARCHAR(255)) ENGINE=InnoDB;
INSERT INTO t2 VALUES ('foobar'),('qux');
 
UPDATE t1 JOIN t2 SET f = a;
 
# Cleanup
DROP TABLE t1, t2;

10.4 dc22acfd

2020-05-22 21:48:19 0x7f68383bc700  InnoDB: Assertion failure in file /data/src/10.4/storage/innobase/fts/fts0fts.cc line 2208
InnoDB: Failing assertion: result != FTS_INVALID
 
#6  0x000055bcd1df1052 in ut_dbg_assertion_failed (expr=0x55bcd26066cc "result != FTS_INVALID", file=0x55bcd2605f70 "/data/src/10.4/storage/innobase/fts/fts0fts.cc", line=2208) at /data/src/10.4/storage/innobase/ut/ut0dbg.cc:60
#7  0x000055bcd1f54995 in fts_trx_row_get_new_state (old_state=FTS_DELETE, event=FTS_DELETE) at /data/src/10.4/storage/innobase/fts/fts0fts.cc:2208
#8  0x000055bcd1f54deb in fts_trx_table_add_op (ftt=0x7f67f01b61b0, doc_id=1, state=FTS_DELETE, fts_indexes=0x0) at /data/src/10.4/storage/innobase/fts/fts0fts.cc:2398
#9  0x000055bcd1f54f45 in fts_trx_add_op (trx=0x7f6838e54140, table=0x7f67f000bc30, doc_id=1, state=FTS_DELETE, fts_indexes=0x0) at /data/src/10.4/storage/innobase/fts/fts0fts.cc:2445
#10 0x000055bcd1d12e7b in row_fts_do_update (trx=0x7f6838e54140, table=0x7f67f000bc30, old_doc_id=1, new_doc_id=3) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1701
#11 0x000055bcd1d13049 in row_fts_update_or_delete (prebuilt=0x7f67f0052b40) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1738
#12 0x000055bcd1d1396c in row_update_for_mysql (prebuilt=0x7f67f0052b40) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1921
#13 0x000055bcd1b6c2f4 in ha_innobase::update_row (this=0x7f67f000b3f8, old_row=0x7f67f004a408 "\374\006", new_row=0x7f67f004a3f0 "\374\003") at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:8796
#14 0x000055bcd192df2c in handler::ha_update_row (this=0x7f67f000b3f8, old_data=0x7f67f004a408 "\374\006", new_data=0x7f67f004a3f0 "\374\003") at /data/src/10.4/sql/handler.cc:6751
#15 0x000055bcd16dac4f in multi_update::send_data (this=0x7f67f0014a78, not_used_values=...) at /data/src/10.4/sql/sql_update.cc:2527
#16 0x000055bcd16473b1 in end_send (join=0x7f67f0014b50, join_tab=0x7f67f0017408, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:21555
#17 0x000055bcd1644a43 in evaluate_join_record (join=0x7f67f0014b50, join_tab=0x7f67f0017060, error=0) at /data/src/10.4/sql/sql_select.cc:20586
#18 0x000055bcd16444de in sub_select (join=0x7f67f0014b50, join_tab=0x7f67f0017060, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20405
#19 0x000055bcd1644a43 in evaluate_join_record (join=0x7f67f0014b50, join_tab=0x7f67f0016cb8, error=0) at /data/src/10.4/sql/sql_select.cc:20586
#20 0x000055bcd1644329 in sub_select (join=0x7f67f0014b50, join_tab=0x7f67f0016cb8, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20366
#21 0x000055bcd16437b8 in do_select (join=0x7f67f0014b50, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19904
#22 0x000055bcd16186a1 in JOIN::exec_inner (this=0x7f67f0014b50) at /data/src/10.4/sql/sql_select.cc:4459
#23 0x000055bcd16177de in JOIN::exec (this=0x7f67f0014b50) at /data/src/10.4/sql/sql_select.cc:4241
#24 0x000055bcd1618ef3 in mysql_select (thd=0x7f67f0000af0, tables=0x7f67f0013280, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7f67f0014a78, unit=0x7f67f0004a18, select_lex=0x7f67f0005210) at /data/src/10.4/sql/sql_select.cc:4673
#25 0x000055bcd16d8ab4 in mysql_multi_update (thd=0x7f67f0000af0, table_list=0x7f67f0013280, fields=0x7f67f0005358, values=0x7f67f00058e0, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7f67f0004a18, select_lex=0x7f67f0005210, result=0x7f68383baf00) at /data/src/10.4/sql/sql_update.cc:1927
#26 0x000055bcd15c7845 in mysql_execute_command (thd=0x7f67f0000af0) at /data/src/10.4/sql/sql_parse.cc:4445
#27 0x000055bcd15d3509 in mysql_parse (thd=0x7f67f0000af0, rawbuf=0x7f67f0013198 "UPDATE t1 JOIN t2 SET f = a", length=27, parser_state=0x7f68383bb570, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7900
#28 0x000055bcd15bfab9 in dispatch_command (command=COM_QUERY, thd=0x7f67f0000af0, packet=0x7f67f0156a01 "UPDATE t1 JOIN t2 SET f = a", packet_length=27, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
#29 0x000055bcd15be25b in do_command (thd=0x7f67f0000af0) at /data/src/10.4/sql/sql_parse.cc:1360
#30 0x000055bcd1745e6a in do_handle_one_connection (connect=0x55bcd56a89f0) at /data/src/10.4/sql/sql_connect.cc:1412
#31 0x000055bcd1745bb9 in handle_one_connection (arg=0x55bcd56a89f0) at /data/src/10.4/sql/sql_connect.cc:1316
#32 0x000055bcd2143291 in pfs_spawn_thread (arg=0x55bcd56c42d0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#33 0x00007f6840f9b4a4 in start_thread (arg=0x7f68383bc700) at pthread_create.c:456
#34 0x00007f683f0cfd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible on 10.4 and 10.5, non-debug, debug and asan builds alike.
The test case is not applicable to earlier versions due to the use of the unique blob.



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2020-05-26 ]

--source include/have_innodb.inc
CREATE TABLE t1 (f TEXT) ENGINE=InnoDB;
INSERT INTO t1(f) VALUES ('foo');
CREATE OR REPLACE TABLE t2 (a VARCHAR(255)) ENGINE=InnoDB;
INSERT INTO t2 VALUES ('foobar'),('qux');
UPDATE t1 JOIN t2 SET f = a;
select * from t1;
f
foobar
DROP TABLE t1, t2;
 
--source include/have_innodb.inc
CREATE TABLE t1 (f TEXT unique) ENGINE=InnoDB;
INSERT INTO t1(f) VALUES ('foo');
CREATE OR REPLACE TABLE t2 (a VARCHAR(255)) ENGINE=InnoDB;
INSERT INTO t2 VALUES ('foobar'),('qux');
UPDATE t1 JOIN t2 SET f = a;
select * from t1;
f
qux
DROP TABLE t1, t2;

I am not sure how update queries behaves differently based on unique blob index. Could be related to MDEV-371

Comment by Elena Stepanova [ 2022-01-09 ]

The commit below made the failure (at least with this test case) disappear in 10.5.

commit d543363f25f96a6cf1779904ea483c59effa1796
Author: Nikita Malyavin
Date:   Thu Sep 24 21:59:28 2020 +1000
 
    MDEV-22714 Assertion failed upon multi-update on table WITHOUT OVERLAPS

I am not sure whether it actually fixed the underlying problem or just hid it, In the latter case we might need a new test case for 10.5+.
However, on 10.4, the originally reported one still causes the failure

Comment by Elena Stepanova [ 2022-02-14 ]

Here is a test case which reproduces the same assertion failure on all 10.4+. It doesn't do multi-update, so I'm not absolutely sure it's the same problem, but since they don't think there is much point in creating a new JIRA, I'll just put it here for now.

--source include/have_innodb.inc
 
CREATE TABLE t1 (
  FTS_DOC_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  f INT,
  b TEXT,
  UNIQUE(b),
  FULLTEXT (b),
  UNIQUE (f)
) ENGINE=InnoDB;
INSERT INTO t1 (f,b) VALUES (10,'bar'),(11,NULL);
ALTER TABLE t1 FORCE;
START TRANSACTION;
REPLACE INTO t1 SELECT * FROM t1;
REPLACE INTO t1 SELECT * FROM t1;
 
# Cleanup
DROP TABLE t1;

10.7 c62720d0

2022-02-15 00:04:46 0x7f1545518700  InnoDB: Assertion failure in file /data/src/10.7/storage/innobase/fts/fts0fts.cc line 2142
InnoDB: Failing assertion: result != FTS_INVALID
 
#6  0x000055c82fce320b in ut_dbg_assertion_failed (expr=0x55c8304596ac "result != FTS_INVALID", file=0x55c830458a40 "/data/src/10.7/storage/innobase/fts/fts0fts.cc", line=2142) at /data/src/10.7/storage/innobase/ut/ut0dbg.cc:60
#7  0x000055c82fe14ea6 in fts_trx_row_get_new_state (old_state=FTS_INSERT, event=FTS_INSERT) at /data/src/10.7/storage/innobase/fts/fts0fts.cc:2142
#8  0x000055c82fe152ea in fts_trx_table_add_op (ftt=0x7f14f0107e58, doc_id=2, state=FTS_INSERT, fts_indexes=0x0) at /data/src/10.7/storage/innobase/fts/fts0fts.cc:2332
#9  0x000055c82fe1545f in fts_trx_add_op (trx=0x7f15467c21e0, table=0x7f14f007a7b8, doc_id=2, state=FTS_INSERT, fts_indexes=0x0) at /data/src/10.7/storage/innobase/fts/fts0fts.cc:2379
#10 0x000055c82fc2ba53 in row_insert_for_mysql (mysql_rec=0x7f14f0b34bf8 "\376\002", prebuilt=0x7f14f0116be8, ins_mode=ROW_INS_NORMAL) at /data/src/10.7/storage/innobase/row/row0mysql.cc:1392
#11 0x000055c82fa6c087 in ha_innobase::write_row (this=0x7f14f0232cc0, record=0x7f14f0b34bf8 "\376\002") at /data/src/10.7/storage/innobase/handler/ha_innodb.cc:7878
#12 0x000055c82f69c59b in handler::ha_write_row (this=0x7f14f0232cc0, buf=0x7f14f0b34bf8 "\376\002") at /data/src/10.7/sql/handler.cc:7519
#13 0x000055c82f290938 in write_record (thd=0x7f14f0000db8, table=0x7f14f0213ea8, info=0x7f14f0017178, sink=0x0) at /data/src/10.7/sql/sql_insert.cc:1833
#14 0x000055c82f297701 in select_insert::send_data (this=0x7f14f0017128, values=...) at /data/src/10.7/sql/sql_insert.cc:4120
#15 0x000055c82f399be3 in select_result_sink::send_data_with_check (this=0x7f14f0017128, items=..., u=0x7f14f00051c0, sent=1) at /data/src/10.7/sql/sql_class.h:5605
#16 0x000055c82f37ff08 in end_send (join=0x7f14f00171e8, join_tab=0x7f14f0103bc0, end_of_records=false) at /data/src/10.7/sql/sql_select.cc:22335
#17 0x000055c82f37d412 in evaluate_join_record (join=0x7f14f00171e8, join_tab=0x7f14f0103810, error=0) at /data/src/10.7/sql/sql_select.cc:21329
#18 0x000055c82f394182 in AGGR_OP::end_send (this=0x7f14f00192e0) at /data/src/10.7/sql/sql_select.cc:29551
#19 0x000055c82f37c67e in sub_select_postjoin_aggr (join=0x7f14f00171e8, join_tab=0x7f14f0103810, end_of_records=true) at /data/src/10.7/sql/sql_select.cc:20809
#20 0x000055c82f37c9df in sub_select (join=0x7f14f00171e8, join_tab=0x7f14f0103460, end_of_records=true) at /data/src/10.7/sql/sql_select.cc:21044
#21 0x000055c82f37c162 in do_select (join=0x7f14f00171e8, procedure=0x0) at /data/src/10.7/sql/sql_select.cc:20646
#22 0x000055c82f34f77c in JOIN::exec_inner (this=0x7f14f00171e8) at /data/src/10.7/sql/sql_select.cc:4751
#23 0x000055c82f34e7f1 in JOIN::exec (this=0x7f14f00171e8) at /data/src/10.7/sql/sql_select.cc:4529
#24 0x000055c82f350122 in mysql_select (thd=0x7f14f0000db8, tables=0x7f14f00161a8, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2202245794560, result=0x7f14f0017128, unit=0x7f14f00051c0, select_lex=0x7f14f0015bd0) at /data/src/10.7/sql/sql_select.cc:5009
#25 0x000055c82f33f41b in handle_select (thd=0x7f14f0000db8, lex=0x7f14f00050e8, result=0x7f14f0017128, setup_tables_done_option=1073741824) at /data/src/10.7/sql/sql_select.cc:545
#26 0x000055c82f2e2647 in mysql_execute_command (thd=0x7f14f0000db8, is_called_from_prepared_stmt=false) at /data/src/10.7/sql/sql_parse.cc:4708
#27 0x000055c82f2ed593 in mysql_parse (thd=0x7f14f0000db8, rawbuf=0x7f14f0015400 "REPLACE INTO t1 SELECT * FROM t1", length=32, parser_state=0x7f1545517500) at /data/src/10.7/sql/sql_parse.cc:8027
#28 0x000055c82f2d9bf8 in dispatch_command (command=COM_QUERY, thd=0x7f14f0000db8, packet=0x7f14f000b989 "REPLACE INTO t1 SELECT * FROM t1", packet_length=32, blocking=true) at /data/src/10.7/sql/sql_parse.cc:1894
#29 0x000055c82f2d85b2 in do_command (thd=0x7f14f0000db8, blocking=true) at /data/src/10.7/sql/sql_parse.cc:1402
#30 0x000055c82f4a86e8 in do_handle_one_connection (connect=0x55c833998978, put_in_cache=true) at /data/src/10.7/sql/sql_connect.cc:1418
#31 0x000055c82f4a8387 in handle_one_connection (arg=0x55c83399b118) at /data/src/10.7/sql/sql_connect.cc:1312
#32 0x000055c82f99102e in pfs_spawn_thread (arg=0x55c8339984e8) at /data/src/10.7/storage/perfschema/pfs.cc:2201
#33 0x00007f154c631ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#34 0x00007f154c230def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

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