[MDEV-21138] Assertion `col->ord_part' or `f.col->ord_part' failed in row_build_index_entry_low, assertion: buf != field_ref_zero in row_merge_buf_add Created: 2019-11-23  Updated: 2022-12-26  Resolved: 2020-12-22

Status: Closed
Project: MariaDB Server
Component/s: Full-text Search, Storage Engine - InnoDB, Versioned Tables
Affects Version/s: 10.3, 10.4
Fix Version/s: 10.3.28, 10.4.18

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-23644 Assertion on evaluating foreign refer... Closed
Duplicate
duplicates MDEV-23992 InnoDB: Failing assertion: buf != fie... Closed
is duplicated by MDEV-21137 Assertion `mode == 16 || mode == 12 |... Closed
Problem/Incident
causes MDEV-24476 Overloaded functions dbug_print_rec b... Closed
Relates
relates to MDEV-24396 Extra history row when deleting from ... Open
relates to MDEV-24403 Segfault on CREATE TABLE with explici... Closed
relates to MDEV-25004 Missing row in FTS_DOC_ID_INDEX durin... Closed

 Description   

Note: See also MDEV-21137 which has a similar test case but a different outcome. Possibly there is a relation.

--source include/have_innodb.inc
 
CREATE TABLE t1 (f1 INT, f2 TEXT, f3 INT, FULLTEXT (f2), KEY(f1), KEY(f3), FOREIGN KEY r (f3) REFERENCES t1 (f1) ON DELETE SET NULL) WITH SYSTEM VERSIONING ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,REPEAT('a',8193),1),(1,REPEAT('b',8193),1);
DELETE FROM t1;
 
# Cleanup
DROP TABLE t1;

10.3 a1454426

mysqld: /data/src/10.3/storage/innobase/row/row0row.cc:315: dtuple_t* row_build_index_entry_low(const dtuple_t*, const row_ext_t*, const dict_index_t*, mem_heap_t*, ulint): Assertion `col->ord_part' failed.
191123 22:18:40 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f9a5e047f12 in __GI___assert_fail (assertion=0x557d6d3be880 "col->ord_part", file=0x557d6d3be718 "/data/src/10.3/storage/innobase/row/row0row.cc", line=315, function=0x557d6d3bf1a0 <row_build_index_entry_low(dtuple_t const*, row_ext_t const*, dict_index_t const*, mem_block_info_t*, unsigned long)::__PRETTY_FUNCTION__> "dtuple_t* row_build_index_entry_low(const dtuple_t*, const row_ext_t*, const dict_index_t*, mem_heap_t*, ulint)") at assert.c:101
#8  0x0000557d6cc2f54d in row_build_index_entry_low (row=0x7f9a04054ae0, ext=0x0, index=0x7f9a0406ec28, heap=0x7f9a0404e110, flag=3) at /data/src/10.3/storage/innobase/row/row0row.cc:315
#9  0x0000557d6cbcb366 in ins_node_create_entry_list (node=0x7f9a04054c00) at /data/src/10.3/storage/innobase/row/row0ins.cc:122
#10 0x0000557d6cbcb695 in ins_node_set_new_row (node=0x7f9a04054c00, row=0x7f9a04054ae0) at /data/src/10.3/storage/innobase/row/row0ins.cc:200
#11 0x0000557d6cbfe06d in row_update_vers_insert (thr=0x7f9a040476f8, node=0x7f9a0404d728) at /data/src/10.3/storage/innobase/row/row0mysql.cc:2176
#12 0x0000557d6cbfe2d5 in row_update_cascade_for_mysql (thr=0x7f9a040476f8, node=0x7f9a0404d728, table=0x7f9a0400c278) at /data/src/10.3/storage/innobase/row/row0mysql.cc:2247
#13 0x0000557d6cbcf003 in row_ins_foreign_check_on_constraint (thr=0x7f9a040476f8, foreign=0x7f9a0406d198, pcur=0x7f9a5339ea70, entry=0x7f9a0404d4a8, mtr=0x7f9a5339eed0) at /data/src/10.3/storage/innobase/row/row0ins.cc:1441
#14 0x0000557d6cbd00d6 in row_ins_check_foreign_constraint (check_ref=0, foreign=0x7f9a0406d198, table=0x7f9a0400c278, entry=0x7f9a0404d4a8, thr=0x7f9a040476f8) at /data/src/10.3/storage/innobase/row/row0ins.cc:1864
#15 0x0000557d6cc62821 in row_upd_check_references_constraints (node=0x7f9a04042e90, pcur=0x7f9a5339f550, table=0x7f9a0400c278, index=0x7f9a040a5358, offsets=0x7f9a0404cef0, thr=0x7f9a040476f8, mtr=0x7f9a5339fc50) at /data/src/10.3/storage/innobase/row/row0upd.cc:296
#16 0x0000557d6cc68932 in row_upd_sec_index_entry (node=0x7f9a04042e90, thr=0x7f9a040476f8) at /data/src/10.3/storage/innobase/row/row0upd.cc:2520
#17 0x0000557d6cc68ca1 in row_upd_sec_step (node=0x7f9a04042e90, thr=0x7f9a040476f8) at /data/src/10.3/storage/innobase/row/row0upd.cc:2569
#18 0x0000557d6cc6ba3d in row_upd (node=0x7f9a04042e90, thr=0x7f9a040476f8) at /data/src/10.3/storage/innobase/row/row0upd.cc:3336
#19 0x0000557d6cc6be8a in row_upd_step (thr=0x7f9a040476f8) at /data/src/10.3/storage/innobase/row/row0upd.cc:3451
#20 0x0000557d6cbfd468 in row_update_for_mysql (prebuilt=0x7f9a04042258) at /data/src/10.3/storage/innobase/row/row0mysql.cc:1888
#21 0x0000557d6ca695a7 in ha_innobase::update_row (this=0x7f9a040411e8, old_row=0x7f9a04033198 "\370\001", new_row=0x7f9a04033170 "\370\001") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:8849
#22 0x0000557d6c848248 in handler::ha_update_row (this=0x7f9a040411e8, old_data=0x7f9a04033198 "\370\001", new_data=0x7f9a04033170 "\370\001") at /data/src/10.3/sql/handler.cc:6478
#23 0x0000557d6c9ef67d in TABLE::delete_row (this=0x7f9a040405a0) at /data/src/10.3/sql/sql_delete.cc:257
#24 0x0000557d6c9ec878 in mysql_delete (thd=0x7f9a04000af0, table_list=0x7f9a040128d0, conds=0x0, order_list=0x7f9a040053b8, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.3/sql/sql_delete.cc:750
#25 0x0000557d6c52297c in mysql_execute_command (thd=0x7f9a04000af0) at /data/src/10.3/sql/sql_parse.cc:4658
#26 0x0000557d6c52d497 in mysql_parse (thd=0x7f9a04000af0, rawbuf=0x7f9a04012808 "DELETE FROM t1", length=14, parser_state=0x7f9a533a15e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7815
#27 0x0000557d6c51a01b in dispatch_command (command=COM_QUERY, thd=0x7f9a04000af0, packet=0x7f9a0415fe61 "DELETE FROM t1", packet_length=14, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856
#28 0x0000557d6c518963 in do_command (thd=0x7f9a04000af0) at /data/src/10.3/sql/sql_parse.cc:1401
#29 0x0000557d6c68f8fa in do_handle_one_connection (connect=0x557d6fa294d0) at /data/src/10.3/sql/sql_connect.cc:1403
#30 0x0000557d6c68f65c in handle_one_connection (arg=0x557d6fa294d0) at /data/src/10.3/sql/sql_connect.cc:1308
#31 0x0000557d6d03c0a8 in pfs_spawn_thread (arg=0x557d6f973300) at /data/src/10.3/storage/perfschema/pfs.cc:1862
#32 0x00007f9a5fbbd4a4 in start_thread (arg=0x7f9a533a2700) at pthread_create.c:456
#33 0x00007f9a5e104d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

10.4 f9528821

mysqld: /data/src/10.4/storage/innobase/row/row0row.cc:317: dtuple_t* row_build_index_entry_low(const dtuple_t*, const row_ext_t*, const dict_index_t*, mem_heap_t*, ulint): Assertion `f.col->ord_part' failed.
191123 22:19:34 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fdb2bae5f12 in __GI___assert_fail (assertion=0x55be299ed3b0 "f.col->ord_part", file=0x55be299ed220 "/data/src/10.4/storage/innobase/row/row0row.cc", line=317, function=0x55be299edea0 <row_build_index_entry_low(dtuple_t const*, row_ext_t const*, dict_index_t const*, mem_block_info_t*, unsigned long)::__PRETTY_FUNCTION__> "dtuple_t* row_build_index_entry_low(const dtuple_t*, const row_ext_t*, const dict_index_t*, mem_heap_t*, ulint)") at assert.c:101
#8  0x000055be291f2722 in row_build_index_entry_low (row=0x7fdad41bb070, ext=0x0, index=0x7fdad413cb88, heap=0x7fdad41b47b0, flag=3) at /data/src/10.4/storage/innobase/row/row0row.cc:317
#9  0x000055be2918e618 in ins_node_create_entry_list (node=0x7fdad41bb190) at /data/src/10.4/storage/innobase/row/row0ins.cc:119
#10 0x000055be2918e947 in ins_node_set_new_row (node=0x7fdad41bb190, row=0x7fdad41bb070) at /data/src/10.4/storage/innobase/row/row0ins.cc:197
#11 0x000055be291c031b in row_update_vers_insert (thr=0x7fdad41ad5b8, node=0x7fdad41b3c38) at /data/src/10.4/storage/innobase/row/row0mysql.cc:2177
#12 0x000055be291c058f in row_update_cascade_for_mysql (thr=0x7fdad41ad5b8, node=0x7fdad41b3c38, table=0x7fdad4149898) at /data/src/10.4/storage/innobase/row/row0mysql.cc:2248
#13 0x000055be291922c3 in row_ins_foreign_check_on_constraint (thr=0x7fdad41ad5b8, foreign=0x7fdad4142448, pcur=0x7fdb24eb2ef0, entry=0x7fdad41b38a8, mtr=0x7fdb24eb3350) at /data/src/10.4/storage/innobase/row/row0ins.cc:1441
#14 0x000055be29193360 in row_ins_check_foreign_constraint (check_ref=0, foreign=0x7fdad4142448, table=0x7fdad4149898, entry=0x7fdad41b38a8, thr=0x7fdad41ad5b8) at /data/src/10.4/storage/innobase/row/row0ins.cc:1850
#15 0x000055be2921a1a3 in row_upd_check_references_constraints (node=0x7fdad4053af8, pcur=0x7fdb24eb39d0, table=0x7fdad4149898, index=0x7fdad413eee8, offsets=0x7fdad41b3480, thr=0x7fdad41ad5b8, mtr=0x7fdb24eb40d0) at /data/src/10.4/storage/innobase/row/row0upd.cc:297
#16 0x000055be292205e2 in row_upd_sec_index_entry (node=0x7fdad4053af8, thr=0x7fdad41ad5b8) at /data/src/10.4/storage/innobase/row/row0upd.cc:2502
#17 0x000055be29220940 in row_upd_sec_step (node=0x7fdad4053af8, thr=0x7fdad41ad5b8) at /data/src/10.4/storage/innobase/row/row0upd.cc:2549
#18 0x000055be2922393e in row_upd (node=0x7fdad4053af8, thr=0x7fdad41ad5b8) at /data/src/10.4/storage/innobase/row/row0upd.cc:3327
#19 0x000055be29223d84 in row_upd_step (thr=0x7fdad41ad5b8) at /data/src/10.4/storage/innobase/row/row0upd.cc:3442
#20 0x000055be291bf706 in row_update_for_mysql (prebuilt=0x7fdad4052eb8) at /data/src/10.4/storage/innobase/row/row0mysql.cc:1889
#21 0x000055be2901ece6 in ha_innobase::update_row (this=0x7fdad4051e38, old_row=0x7fdad40406d8 "\370\001", new_row=0x7fdad40406b0 "\370\001") at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:8840
#22 0x000055be28de076e in handler::ha_update_row (this=0x7fdad4051e38, old_data=0x7fdad40406d8 "\370\001", new_data=0x7fdad40406b0 "\370\001") at /data/src/10.4/sql/handler.cc:6719
#23 0x000055be28f9b3a5 in TABLE::delete_row (this=0x7fdad4050fd0) at /data/src/10.4/sql/sql_delete.cc:301
#24 0x000055be28f9821c in mysql_delete (thd=0x7fdad4000af0, table_list=0x7fdad4013200, conds=0x0, order_list=0x7fdad40054a0, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.4/sql/sql_delete.cc:834
#25 0x000055be28a74582 in mysql_execute_command (thd=0x7fdad4000af0) at /data/src/10.4/sql/sql_parse.cc:4728
#26 0x000055be28a7fdaf in mysql_parse (thd=0x7fdad4000af0, rawbuf=0x7fdad4013138 "DELETE FROM t1", length=14, parser_state=0x7fdb24eb6170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7898
#27 0x000055be28a6af8c in dispatch_command (command=COM_QUERY, thd=0x7fdad4000af0, packet=0x7fdad419de21 "DELETE FROM t1", packet_length=14, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
#28 0x000055be28a69619 in do_command (thd=0x7fdad4000af0) at /data/src/10.4/sql/sql_parse.cc:1360
#29 0x000055be28bf18d1 in do_handle_one_connection (connect=0x55be2c2bec60) at /data/src/10.4/sql/sql_connect.cc:1412
#30 0x000055be28bf1620 in handle_one_connection (arg=0x55be2c2bec60) at /data/src/10.4/sql/sql_connect.cc:1316
#31 0x000055be295f39a5 in pfs_spawn_thread (arg=0x55be2c1e3890) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#32 0x00007fdb2d65b4a4 in start_thread (arg=0x7fdb24eb7700) at pthread_create.c:456
#33 0x00007fdb2bba2d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible on 10.3-10.5.
Non-debug build doesn't crash, DELETE fails with an error instead:

CURRENT_TEST: bug.t
mysqltest: At line 5: query 'DELETE FROM t1' failed: 1761: Foreign key constraint for table 't1', record '1' would lead to a duplicate entry in table 't1', key 'FTS_DOC_ID_INDEX'



 Comments   
Comment by Aleksey Midenkov [ 2020-01-04 ]

Analysis

Comment by Elena Stepanova [ 2020-10-20 ]

A modification of the test case (extra ALTER after the failing DELETE) triggers a non-debug assertion failure or SIGABRT:

Assertion failure (with ROW_FORMAT=COMPRESSED)

--source include/have_innodb.inc
 
CREATE TABLE t1 (f1 INT, f2 TEXT, f3 INT, FULLTEXT (f2), KEY(f1), KEY(f3), FOREIGN KEY r (f3) REFERENCES t1 (f1) ON DELETE SET NULL) WITH SYSTEM VERSIONING ROW_FORMAT=COMPRESSED ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,REPEAT('a',8193),1),(1,REPEAT('b',8193),1);
--error ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO
DELETE FROM t1;
ALTER TABLE t1 ADD KEY idx (f2(10));
 
# Cleanup
DROP TABLE t1;

10.3 311b7f94 non-debug

2020-10-20 15:09:27 9 [ERROR] InnoDB: Duplicate FTS_DOC_ID value on table `test`.`t1`
2020-10-20 15:09:27 9 [ERROR] InnoDB: Unexpected type 17855 of compressed BLOB page [page id: space=5, page number=8]
2020-10-20 15:09:27 0x7f67ccb4d300  InnoDB: Assertion failure in file /data/src/10.3/storage/innobase/row/row0merge.cc line 733
InnoDB: Failing assertion: buf != field_ref_zero
 
#6  0x00005621ad4475e0 in ut_dbg_assertion_failed (expr=expr@entry=0x5621af3115a0 "buf != field_ref_zero", file=file@entry=0x5621af3113a0 "/data/src/10.3/storage/innobase/row/row0merge.cc", line=line@entry=733) at /data/src/10.3/storage/innobase/ut/ut0dbg.cc:60
#7  0x00005621ad4177c4 in row_merge_buf_add (buf=<optimized out>, fts_index=<optimized out>, old_table=<optimized out>, new_table=<optimized out>, psort_info=<optimized out>, row=<optimized out>, ext=<optimized out>, doc_id=<optimized out>, conv_heap=<optimized out>, err=<optimized out>, v_heap=<optimized out>, my_table=<optimized out>, trx=<optimized out>) at /data/src/10.3/storage/innobase/row/row0merge.cc:733
#8  0x00005621ae6385a1 in row_merge_read_clustered_index (trx=<optimized out>, table=<optimized out>, old_table=<optimized out>, new_table=<optimized out>, online=<optimized out>, index=<optimized out>, fts_sort_idx=<optimized out>, psort_info=<optimized out>, files=<optimized out>, key_numbers=<optimized out>, n_index=<optimized out>, defaults=<optimized out>, add_v=<optimized out>, col_map=<optimized out>, add_autoinc=<optimized out>, sequence=..., block=<optimized out>, skip_pk_sort=<optimized out>, tmpfd=<optimized out>, stage=<optimized out>, pct_cost=<optimized out>, crypt_block=<optimized out>, eval_table=<optimized out>, allow_not_null=<optimized out>) at /data/src/10.3/storage/innobase/row/row0merge.cc:2354
#9  0x00005621ae63f624 in row_merge_build_indexes (trx=<optimized out>, old_table=old_table@entry=0x6170000356f0, new_table=<optimized out>, online=<optimized out>, indexes=<optimized out>, key_numbers=<optimized out>, n_indexes=<optimized out>, table=<optimized out>, defaults=<optimized out>, col_map=<optimized out>, add_autoinc=<optimized out>, sequence=..., skip_pk_sort=<optimized out>, stage=<optimized out>, add_v=<optimized out>, eval_table=<optimized out>, allow_not_null=<optimized out>) at /data/src/10.3/storage/innobase/row/row0merge.cc:4709
#10 0x00005621ae427fda in ha_innobase::inplace_alter_table (this=<optimized out>, altered_table=<optimized out>, ha_alter_info=<optimized out>) at /data/src/10.3/storage/innobase/handler/handler0alter.cc:7154
#11 0x00005621ad96a9e7 in handler::ha_inplace_alter_table (ha_alter_info=0x7f67ccb44400, altered_table=0x61f000045288, this=<optimized out>) at /data/src/10.3/sql/sql_table.cc:7788
#12 mysql_inplace_alter_table (thd=0x62a0000ae208, table_list=<optimized out>, table=0x61f000043688, altered_table=<optimized out>, ha_alter_info=<optimized out>, inplace_supported=<optimized out>, alter_ctx=<optimized out>, target_mdl_request=<optimized out>) at /data/src/10.3/sql/sql_table.cc:7654
#13 0x00005621ad9955a6 in mysql_alter_table (thd=thd@entry=0x62a0000ae208, new_db=new_db@entry=0x62a0000b2730, new_name=new_name@entry=0x62a0000b2af8, create_info=create_info@entry=0x7f67ccb468c0, table_list=<optimized out>, table_list@entry=0x62b000000350, alter_info=alter_info@entry=0x7f67ccb467c0, order_num=<optimized out>, order=<optimized out>, ignore=<optimized out>) at /data/src/10.3/sql/sql_table.cc:9946
#14 0x00005621adab8c41 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x62a0000ae208) at /data/src/10.3/sql/sql_alter.cc:512
#15 0x00005621ad74fc87 in mysql_execute_command (thd=0x62a0000ae208) at /data/src/10.3/sql/sql_parse.cc:6022
#16 0x00005621ad7683e0 in mysql_parse (thd=thd@entry=0x62a0000ae208, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f67ccb4afb0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.3/sql/sql_parse.cc:7810
#17 0x00005621ad76f027 in dispatch_command (command=COM_QUERY, thd=0x62a0000ae208, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.3/sql/sql_class.h:1137
#18 0x00005621ad775e0e in do_command (thd=0x62a0000ae208) at /data/src/10.3/sql/sql_parse.cc:1393
#19 0x00005621adaae7e7 in do_handle_one_connection (connect=connect@entry=0x608000000ea8) at /data/src/10.3/sql/sql_connect.cc:1403
#20 0x00005621adaaf06f in handle_one_connection (arg=arg@entry=0x608000000ea8) at /data/src/10.3/sql/sql_connect.cc:1308
#21 0x00005621aee27c99 in pfs_spawn_thread (arg=0x615000005588) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#22 0x00007f67e3473609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x00007f67e304f293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Fatal error (with default ROW_FORMAT)

--source include/have_innodb.inc
 
CREATE TABLE t1 (f1 INT, f2 TEXT, f3 INT, FULLTEXT (f2), KEY(f1), KEY(f3), FOREIGN KEY r (f3) REFERENCES t1 (f1) ON DELETE SET NULL) WITH SYSTEM VERSIONING ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,REPEAT('a',8193),1),(1,REPEAT('b',8193),1);
--error ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO
DELETE FROM t1;
ALTER TABLE t1 ADD KEY idx (f2(10));
 
# Cleanup
DROP TABLE t1;

2020-10-20 15:11:10 9 [ERROR] InnoDB: Duplicate FTS_DOC_ID value on table `test`.`t1`
2020-10-20 15:11:10 9 [ERROR] [FATAL] InnoDB: FIL_PAGE_TYPE=17855 on BLOB read space 5 page 8 flags 33
201020 15:11:10 [ERROR] mysqld got signal 6 ;
 
#5  0x00007fb8b2a68859 in __GI_abort () at abort.c:79
#6  0x00005586ed755bf5 in ib::fatal::~fatal (this=<optimized out>, __in_chrg=<optimized out>) at /data/src/10.3/storage/innobase/ut/ut0ut.cc:603
#7  0x00005586ec3bf802 in btr_check_blob_fil_page_type (space_id=5, page_no=8, page=<optimized out>, read=1) at /data/src/10.3/storage/innobase/include/ut0ut.h:355
#8  0x00005586ed7a7cc3 in btr_copy_blob_prefix (buf=<optimized out>, len=<optimized out>, space_id=<optimized out>, page_no=8, offset=38) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:7995
#9  0x00005586ed7c9355 in btr_copy_externally_stored_field_prefix_low (offset=<optimized out>, page_no=<optimized out>, space_id=<optimized out>, page_size=..., len=3072, buf=<optimized out>) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:8256
#10 btr_copy_externally_stored_field_prefix (buf=<optimized out>, len=3072, page_size=..., data=0x7fb8a8e180e4 <error: Cannot access memory at address 0x7fb8a8e180e4>, local_len=0) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:8257
#11 0x00005586eda78cde in row_ext_cache_fill (dfield=<optimized out>, page_size=..., i=0, ext=0x63100008c9b0) at /data/src/10.3/storage/innobase/row/row0ext.cc:78
#12 row_ext_create (n_ext=n_ext@entry=1, ext=ext@entry=0x63100008c890, flags=<optimized out>, tuple=tuple@entry=0x63100008c8a0, heap=heap@entry=0x63100008c800) at /data/src/10.3/storage/innobase/row/row0ext.cc:128
#13 0x00005586ed5fd501 in row_build_low (type=<optimized out>, index=<optimized out>, rec=<optimized out>, offsets=<optimized out>, col_table=<optimized out>, defaults=<optimized out>, add_v=<optimized out>, col_map=<optimized out>, ext=<optimized out>, heap=<optimized out>) at /data/src/10.3/storage/innobase/row/row0row.cc:569
#14 0x00005586ed5a95c6 in row_merge_read_clustered_index (trx=<optimized out>, table=<optimized out>, old_table=<optimized out>, new_table=<optimized out>, online=<optimized out>, index=<optimized out>, fts_sort_idx=<optimized out>, psort_info=<optimized out>, files=<optimized out>, key_numbers=<optimized out>, n_index=<optimized out>, defaults=<optimized out>, add_v=<optimized out>, col_map=<optimized out>, add_autoinc=<optimized out>, sequence=..., block=<optimized out>, skip_pk_sort=<optimized out>, tmpfd=<optimized out>, stage=<optimized out>, pct_cost=<optimized out>, crypt_block=<optimized out>, eval_table=<optimized out>, allow_not_null=<optimized out>) at /data/src/10.3/storage/innobase/row/row0merge.cc:2156
#15 0x00005586ed5b1624 in row_merge_build_indexes (trx=<optimized out>, old_table=old_table@entry=0x6170000356f0, new_table=<optimized out>, online=<optimized out>, indexes=<optimized out>, key_numbers=<optimized out>, n_indexes=<optimized out>, table=<optimized out>, defaults=<optimized out>, col_map=<optimized out>, add_autoinc=<optimized out>, sequence=..., skip_pk_sort=<optimized out>, stage=<optimized out>, add_v=<optimized out>, eval_table=<optimized out>, allow_not_null=<optimized out>) at /data/src/10.3/storage/innobase/row/row0merge.cc:4709
#16 0x00005586ed399fda in ha_innobase::inplace_alter_table (this=<optimized out>, altered_table=<optimized out>, ha_alter_info=<optimized out>) at /data/src/10.3/storage/innobase/handler/handler0alter.cc:7154
#17 0x00005586ec8dc9e7 in handler::ha_inplace_alter_table (ha_alter_info=0x7fb89c654400, altered_table=0x61f000045288, this=<optimized out>) at /data/src/10.3/sql/sql_table.cc:7788
#18 mysql_inplace_alter_table (thd=0x62a0000ae208, table_list=<optimized out>, table=0x61f000043688, altered_table=<optimized out>, ha_alter_info=<optimized out>, inplace_supported=<optimized out>, alter_ctx=<optimized out>, target_mdl_request=<optimized out>) at /data/src/10.3/sql/sql_table.cc:7654
#19 0x00005586ec9075a6 in mysql_alter_table (thd=thd@entry=0x62a0000ae208, new_db=new_db@entry=0x62a0000b2730, new_name=new_name@entry=0x62a0000b2af8, create_info=create_info@entry=0x7fb89c6568c0, table_list=<optimized out>, table_list@entry=0x62b000000350, alter_info=alter_info@entry=0x7fb89c6567c0, order_num=<optimized out>, order=<optimized out>, ignore=<optimized out>) at /data/src/10.3/sql/sql_table.cc:9946
#20 0x00005586eca2ac41 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x62a0000ae208) at /data/src/10.3/sql/sql_alter.cc:512
#21 0x00005586ec6c1c87 in mysql_execute_command (thd=0x62a0000ae208) at /data/src/10.3/sql/sql_parse.cc:6022
#22 0x00005586ec6da3e0 in mysql_parse (thd=thd@entry=0x62a0000ae208, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fb89c65afb0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.3/sql/sql_parse.cc:7810
#23 0x00005586ec6e1027 in dispatch_command (command=COM_QUERY, thd=0x62a0000ae208, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.3/sql/sql_class.h:1137
#24 0x00005586ec6e7e0e in do_command (thd=0x62a0000ae208) at /data/src/10.3/sql/sql_parse.cc:1393
#25 0x00005586eca207e7 in do_handle_one_connection (connect=connect@entry=0x608000000ea8) at /data/src/10.3/sql/sql_connect.cc:1403
#26 0x00005586eca2106f in handle_one_connection (arg=arg@entry=0x608000000ea8) at /data/src/10.3/sql/sql_connect.cc:1308
#27 0x00005586edd99c99 in pfs_spawn_thread (arg=0x615000005588) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#28 0x00007fb8b2f89609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#29 0x00007fb8b2b65293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Comment by Marko Mäkelä [ 2020-12-14 ]

I think that we must take into account the fact that FTS_DOC_ID_INDEX(FTS_DOC_ID) may be explicitly created by the user. I tried a variation of the test:

--source include/have_innodb.inc
CREATE TABLE t1 (f1 INT, f2 TEXT, f3 INT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, UNIQUE KEY FTS_DOC_ID_INDEX(FTS_DOC_ID), FULLTEXT (f2), KEY(f1), KEY(f3), FOREIGN KEY r (f3) REFERENCES t1 (f1) ON DELETE SET NULL) WITH SYSTEM VERSIONING ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,REPEAT('a',8193),1,1),(1,REPEAT('b',8193),1,2);
DELETE FROM t1;
DROP TABLE t1;

If I remove the words WITH SYSTEM VERSIONING, the test will pass. If I remove the word UNSIGNED, the FTS_DOC_ID will not be of the correct form, and the test will fail.

But, if I retain the magic words WITH SYSTEM VERSIONING, I am seeing a crash during the execution of the CREATE TABLE statement:

10.5 e8217d070fc3e60870131615a48515836c773b07

#0  __pthread_kill (threadid=<optimized out>, signo=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x000000000116a9ce in handle_fatal_signal (sig=<optimized out>) at /mariadb/10.5m/sql/signal_handler.cc:330
#2  <signal handler called>
#3  0x000000000226f334 in fts_drop_all_index_tables (trx=0x7f33e1403af8, fts=<optimized out>) at /mariadb/10.5m/storage/innobase/fts/fts0fts.cc:1659
#4  fts_drop_tables (trx=<optimized out>, table=<optimized out>) at /mariadb/10.5m/storage/innobase/fts/fts0fts.cc:1699
#5  0x0000000001dc5dd2 in row_drop_ancillary_fts_tables (table=0x618000064d08, trx=0x7f33e1403af8) at /mariadb/10.5m/storage/innobase/row/row0mysql.cc:3213
#6  row_drop_table_for_mysql (name=<optimized out>, trx=<optimized out>, sqlcom=<optimized out>, create_failed=<optimized out>, nonatomic=<optimized out>) at /mariadb/10.5m/storage/innobase/row/row0mysql.cc:3680
#7  0x0000000001a7ac26 in ha_innobase::create (this=<optimized out>, name=<optimized out>, form=0x7f33ffffffff, create_info=<optimized out>, file_per_table=<optimized out>, trx=0x7f33e1403af8) at /mariadb/10.5m/storage/innobase/handler/ha_innodb.cc:12950
#8  0x000000000118ceb9 in handler::ha_create (this=0x61d000247cb8, name=<optimized out>, form=<optimized out>, info_arg=<optimized out>) at /mariadb/10.5m/sql/handler.cc:5084
#9  0x0000000001190f38 in ha_create_table (thd=<optimized out>, path=<optimized out>, db=<optimized out>, table_name=<optimized out>, create_info=<optimized out>, frm=<optimized out>) at /mariadb/10.5m/sql/handler.cc:5548
#10 0x0000000000c8f6eb in create_table_impl (thd=<optimized out>, orig_db=<optimized out>, orig_table_name=<optimized out>, db=<optimized out>, table_name=<optimized out>, path=<optimized out>, options=<optimized out>, create_info=<optimized out>, alter_info=<optimized out>, create_table_mode=<optimized out>, is_trans=<optimized out>, key_info=<optimized out>, key_count=<optimized out>, frm=<optimized out>) at /mariadb/10.5m/sql/sql_table.cc:5348

I think that this case must be covered as part of the fix.

Comment by Aleksey Midenkov [ 2020-12-14 ]

This also fails with the same stack trace:

--source include/have_innodb.inc
 
create table t1 (
  f1 int, f2 text,
  FTS_DOC_ID bigint unsigned not null,
  unique key FTS_DOC_ID_INDEX(FTS_DOC_ID, f1),
  fulltext (f2))
engine=innodb;

so it is not the problem of System Versioning. Filed MDEV-24403.

Comment by Aleksey Midenkov [ 2020-12-14 ]

UNIQUE KEY FTS_DOC_ID_INDEX(FTS_DOC_ID) is a magic words specific to InnoDB-only. I'd rather not treat them differently at SQL layer but fail with ER_WRONG_NAME_FOR_INDEX instead.

Comment by Marko Mäkelä [ 2020-12-17 ]

Thank you, this is OK to push after addressing my comments and testing again on buildbot.

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