#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
#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'
Attachments
Issue Links
blocks
MDEV-23644Assertion on evaluating foreign referential action for self-reference in system versioned table
Closed
causes
MDEV-24476Overloaded functions dbug_print_rec break compilation in 10.3
Closed
duplicates
MDEV-23992InnoDB: Failing assertion: buf != field_ref_zero in row_merge_buf_add or FATAL error FIL_PAGE_TYPE=17855 on BLOB read file
#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
#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
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
CREATETABLE t1 (f1 INT, f2 TEXT, f3 INT, FTS_DOC_ID BIGINT UNSIGNED NOTNULL, UNIQUEKEY FTS_DOC_ID_INDEX(FTS_DOC_ID), FULLTEXT (f2), KEY(f1), KEY(f3), FOREIGNKEY r (f3) REFERENCES t1 (f1) ONDELETESETNULL) WITH SYSTEM VERSIONING ENGINE=InnoDB;
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
I think that this case must be covered as part of the fix.
Marko Mäkelä
added a comment - 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.
so it is not the problem of System Versioning. Filed MDEV-24403.
Aleksey Midenkov
added a comment - - edited 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 .
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.
Aleksey Midenkov
added a comment - 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.
Analysis