Open midenok opened 3 years ago
#0 btr_pcur_store_position (cursor=0x7f43100a3ab0, mtr=0x7f43100a35f0) at /home/midenok/src/mariadb/10.3b/src/storage/innobase/btr/btr0pcur.cc:105
#1 0x0000000000f439f4 in row_ins_foreign_check_on_constraint (thr=0x7f42c4045bc0, foreign=0x7f42c4045500, pcur=0x7f43100a3ab0, entry=0x7f42c4083388, mtr=0x7f43100a35f0) at /home/midenok/src/mariadb/10.3b/src/storage/innobase/row/row0ins.cc:1317
#2 0x0000000000f413b6 in row_ins_check_foreign_constraint (check_ref=0, foreign=0x7f42c4045500, table=0x7f42c4039c00, entry=0x7f42c4083388, thr=0x7f42c4045bc0) at /home/midenok/src/mariadb/10.3b/src/storage/innobase/row/row0ins.cc:1762
#3 0x000000000100054d in row_upd_check_references_constraints (node=0x7f42c4036b20, pcur=0x7f43100a40c8, table=0x7f42c4039c00, index=0x7f42c4033450, offsets=0x7f42c4082ad8, thr=0x7f42c4045bc0, mtr=0x7f43100a41c8) at /home/midenok/src/mariadb/10.3b/src/storage/innobase/row/row0upd.cc:295
#4 0x00000000010034e4 in row_upd_sec_index_entry (node=0x7f42c4036b20, thr=0x7f42c4045bc0) at /home/midenok/src/mariadb/10.3b/src/storage/innobase/row/row0upd.cc:2507
#5 0x0000000000ffd84d in row_upd_sec_step (node=0x7f42c4036b20, thr=0x7f42c4045bc0) at /home/midenok/src/mariadb/10.3b/src/storage/innobase/row/row0upd.cc:2556
#6 0x0000000000ff9997 in row_upd (node=0x7f42c4036b20, thr=0x7f42c4045bc0) at /home/midenok/src/mariadb/10.3b/src/storage/innobase/row/row0upd.cc:3331
#7 0x0000000000ff9245 in row_upd_step (thr=0x7f42c4045bc0) at /home/midenok/src/mariadb/10.3b/src/storage/innobase/row/row0upd.cc:3446
#8 0x0000000000f7d381 in row_update_for_mysql (prebuilt=0x7f42c4035e80) at /home/midenok/src/mariadb/10.3b/src/storage/innobase/row/row0mysql.cc:1847
#9 0x0000000000da30d4 in ha_innobase::delete_row (this=0x7f42c4037d90, record=0x7f42c4035be8 "\245\002") at /home/midenok/src/mariadb/10.3b/src/storage/innobase/handler/ha_innodb.cc:8948
#10 0x0000000000b20cde in handler::ha_delete_row (this=0x7f42c4037d90, buf=0x7f42c4035be8 "\245\002") at /home/midenok/src/mariadb/10.3b/src/sql/handler.cc:6554
#11 0x000000000074f5ab in write_record (thd=0x7f42c4000d28, table=0x7f42c4034e08, info=0x7f42c40153a8) at /home/midenok/src/mariadb/10.3b/src/sql/sql_insert.cc:1987
#12 0x000000000075635e in select_insert::send_data (this=0x7f42c4015360, values=...) at /home/midenok/src/mariadb/10.3b/src/sql/sql_insert.cc:3936
Divergence is row_ins_foreign_check_on_constraint() (1317 vs 1339).
(rr) p dbug_print_rec(rec, index)
$3 = 0x7f42c40888c0 "COMPACT RECORD(info_bits=0, 3 fields): {[510] q", ' ' <repeats 506 times>, "(0x000000710020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020002000200020),[4] (0x00000008),[7] B?(0x7FFFFFFF0F423F)}"
(rr) p foreign->foreign_table->name.m_name
$7 = 0x7f42c4013970 "test/t1"
(rr) p foreign->referenced_table->name.m_name
$8 = 0x7f42c4032050 "test/t2"
(rr) p table->name.m_name
$9 = 0x7f42c4013970 "test/t1"
(rr) p pcur.btr_cur.index->name.m_name
$15 = 0x7f42c405add0 "f13"
(rr) p pcur.btr_cur.index->table->name.m_name
$16 = 0x7f42c4013970 "test/t1"
REPLACE is executed on parent table t2
which triggers referential action of updating f13
on foreign table t1
. Cursor is stored in row_ins_foreign_check_on_constraint()
, then it is restored by row_upd_clust_step()
in row_update_cascade_for_mysql()
and record is not found. NB: cursor is stored on secondary index and missed record is in clustered index.
First we have to fix #85 which is more clear failure of executing referential action.
Bug: foreign key cascade set null doesn't work
Reproduce
Result
Record not found on UPDATE SET NULL.
frame 0
Notes