[MDEV-29182] Assertion `fld->field_no < table->n_v_def' failed on cascade FK update of table with vcol index in parent Created: 2022-07-27  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Virtual Columns
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.4, 10.5, 10.6

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

Issue Links:
Relates
relates to MDEV-29068 Cascade foreign key updates do not ap... Closed
relates to MDEV-29181 Potential corruption on Foreign key u... In Review

 Description   

--source include/have_debug_sync.inc
--source include/have_innodb.inc
--connect (con2, localhost, root,,)
--connection default
set default_storage_engine= innodb;
 
 
create table t1 (a int primary key, b int as (a), key(b));
insert into t1(a) values (1),(2),(3);
create table t2 (a int, foreign key (a) references t1 (a)
  on delete cascade on update cascade);
insert into t2(a) values (1),(2),(3);
set debug_sync= "find_table_for_vc_table_valid SIGNAL found WAIT_FOR go";
UPDATE t1 set a = 11 where a = 1;
--send
UPDATE t1 set a = 22 where a = 2;
--connection con2
set debug_sync= "now WAIT_FOR found TIMEOUT 3";
UPDATE t1 set a= 33 where a = 3;
set debug_sync= "now SIGNAL go";
 
--connection default
--reap
 
# Cleanup
drop table t1, t2;
set debug_sync= reset;
--connection default



 Comments   
Comment by Elena Stepanova [ 2022-09-25 ]

Stack trace for the reference:

10.3 66cd1c33

mysqld: /data/src/10.3/storage/innobase/trx/trx0rec.cc:1075: ulint trx_undo_page_report_modify(buf_block_t*, trx_t*, dict_index_t*, const rec_t*, const rec_offs*, const upd_t*, ulint, const dtuple_t*, mtr_t*): Assertion `fld->field_no < table->n_v_def' failed.
220925 15:26:39 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fa5c9c6a662 in __GI___assert_fail (assertion=0x563dc585a600 "fld->field_no < table->n_v_def", file=0x563dc5859500 "/data/src/10.3/storage/innobase/trx/trx0rec.cc", line=1075, function=0x563dc585a280 "ulint trx_undo_page_report_modify(buf_block_t*, trx_t*, dict_index_t*, const rec_t*, const rec_offs*, const upd_t*, ulint, const dtuple_t*, mtr_t*)") at assert.c:101
#8  0x0000563dc47a1aff in trx_undo_page_report_modify (undo_block=0x7fa5bf9f0180, trx=0x7fa5c02c68b8, index=0x618000049d08, rec=0x7fa5bff4007e "", offsets=0x7fa5b3683830, update=0x61a00001c908, cmpl_info=0, row=0x0, mtr=0x7fa5b36825e0) at /data/src/10.3/storage/innobase/trx/trx0rec.cc:1075
#9  0x0000563dc47a7fac in trx_undo_report_row_operation (thr=0x6240001d2188, index=0x618000049d08, clust_entry=0x0, update=0x61a00001c908, cmpl_info=0, rec=0x7fa5bff4007e "", offsets=0x7fa5b3683830, roll_ptr=0x7fa5b3682c70) at /data/src/10.3/storage/innobase/trx/trx0rec.cc:2024
#10 0x0000563dc48624b6 in btr_cur_upd_lock_and_undo (flags=2, cursor=0x611000081dc0, offsets=0x7fa5b3683830, update=0x61a00001c908, cmpl_info=0, thr=0x6240001d2188, mtr=0x7fa5b3683b10, roll_ptr=0x7fa5b3682c70) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:3807
#11 0x0000563dc4864167 in btr_cur_update_in_place (flags=2, cursor=0x611000081dc0, offsets=0x7fa5b3683830, update=0x61a00001c908, cmpl_info=0, thr=0x6240001d2188, trx_id=41, mtr=0x7fa5b3683b10) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:4119
#12 0x0000563dc4865cc0 in btr_cur_optimistic_update (flags=2, cursor=0x611000081dc0, offsets=0x7fa5b3683730, heap=0x7fa5b3683810, update=0x61a00001c908, cmpl_info=0, thr=0x6240001d2188, trx_id=41, mtr=0x7fa5b3683b10) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:4347
#13 0x0000563dc46f05e0 in row_upd_clust_rec (flags=0, node=0x61600005c208, index=0x618000049d08, offsets=0x7fa5b3683830, offsets_heap=0x7fa5b3683810, thr=0x6240001d2188, mtr=0x7fa5b3683b10) at /data/src/10.3/storage/innobase/row/row0upd.cc:2892
#14 0x0000563dc46f243b in row_upd_clust_step (node=0x61600005c208, thr=0x6240001d2188) at /data/src/10.3/storage/innobase/row/row0upd.cc:3241
#15 0x0000563dc46f2c53 in row_upd (node=0x61600005c208, thr=0x6240001d2188) at /data/src/10.3/storage/innobase/row/row0upd.cc:3304
#16 0x0000563dc46f3bc5 in row_upd_step (thr=0x6240001d2188) at /data/src/10.3/storage/innobase/row/row0upd.cc:3448
#17 0x0000563dc4620d49 in row_update_cascade_for_mysql (thr=0x6240001d2188, node=0x61600005c208, table=0x6190000dad08) at /data/src/10.3/storage/innobase/row/row0mysql.cc:2253
#18 0x0000563dc45c3c7c in row_ins_foreign_check_on_constraint (thr=0x6240001d2188, foreign=0x61600005a408, pcur=0x7fa5b3684940, entry=0x61600005bf28, mtr=0x7fa5b3684d50) at /data/src/10.3/storage/innobase/row/row0ins.cc:1338
#19 0x0000563dc45c57fc in row_ins_check_foreign_constraint (check_ref=0, foreign=0x61600005a408, table=0x6190000d5808, entry=0x61600005bf28, thr=0x6240001d2188) at /data/src/10.3/storage/innobase/row/row0ins.cc:1762
#20 0x0000563dc46e241c in row_upd_check_references_constraints (node=0x620000011c18, pcur=0x611000081a00, table=0x6190000d5808, index=0x618000047d08, offsets=0x7fa5b3685500, thr=0x6240001d2188, mtr=0x7fa5b3685b90) at /data/src/10.3/storage/innobase/row/row0upd.cc:298
#21 0x0000563dc46ef7e9 in row_upd_clust_rec_by_insert (node=0x620000011c18, index=0x618000047d08, thr=0x6240001d2188, referenced=true, foreign=false, mtr=0x7fa5b3685b90) at /data/src/10.3/storage/innobase/row/row0upd.cc:2791
#22 0x0000563dc46f2361 in row_upd_clust_step (node=0x620000011c18, thr=0x6240001d2188) at /data/src/10.3/storage/innobase/row/row0upd.cc:3228
#23 0x0000563dc46f2c53 in row_upd (node=0x620000011c18, thr=0x6240001d2188) at /data/src/10.3/storage/innobase/row/row0upd.cc:3304
#24 0x0000563dc46f3bc5 in row_upd_step (thr=0x6240001d2188) at /data/src/10.3/storage/innobase/row/row0upd.cc:3448
#25 0x0000563dc461e3b7 in row_update_for_mysql (prebuilt=0x620000011108) at /data/src/10.3/storage/innobase/row/row0mysql.cc:1827
#26 0x0000563dc42ed7b5 in ha_innobase::update_row (this=0x61c0000638a8, old_row=0x6190000d75c8 "\375\001", new_row=0x6190000d75b8 "\375\v") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:8970
#27 0x0000563dc3da2ab7 in handler::ha_update_row (this=0x61c0000638a8, old_data=0x6190000d75c8 "\375\001", new_data=0x6190000d75b8 "\375\v") at /data/src/10.3/sql/handler.cc:6527
#28 0x0000563dc38c309a in mysql_update (thd=0x62a0000ba208, table_list=0x62b000000340, fields=..., values=..., conds=0x62b000000da0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7fa5b3687160, updated_return=0x7fa5b3687180) at /data/src/10.3/sql/sql_update.cc:963
#29 0x0000563dc36208b2 in mysql_execute_command (thd=0x62a0000ba208) at /data/src/10.3/sql/sql_parse.cc:4344
#30 0x0000563dc36394dc in mysql_parse (thd=0x62a0000ba208, rawbuf=0x62b000000228 "UPDATE t1 set a = 11 where a = 1", length=32, parser_state=0x7fa5b3688a00, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7871
#31 0x0000563dc3610a82 in dispatch_command (command=COM_QUERY, thd=0x62a0000ba208, packet=0x629000136209 "UPDATE t1 set a = 11 where a = 1", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
#32 0x0000563dc360d65e in do_command (thd=0x62a0000ba208) at /data/src/10.3/sql/sql_parse.cc:1398
#33 0x0000563dc39cf068 in do_handle_one_connection (connect=0x6080000010a8) at /data/src/10.3/sql/sql_connect.cc:1403
#34 0x0000563dc39ce964 in handle_one_connection (arg=0x6080000010a8) at /data/src/10.3/sql/sql_connect.cc:1308
#35 0x0000563dc4f79a67 in pfs_spawn_thread (arg=0x615000006c08) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#36 0x00007fa5c9e03ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#37 0x00007fa5c9d33def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

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