Commit 630199e7 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-18981 Possible corruption when using FOREIGN KEY with virtual columns

row_ins_foreign_fill_virtual(): Construct update->old_vrow
with ROW_COPY_DATA instead of ROW_COPY_POINTERS. With the latter,
the object would be pointing to a buffer pool page frame. That page
frame can become stale and invalid as soon as
row_ins_foreign_check_on_constraint() invokes mtr_t::commit().

Most of the time, the pointer target is not going to be overwritten
by anything, and everything appears to work correctly.
Buffer pool page replacement is highly unlikely, and any pessimistic
operation that would overwrite the old location of the record is only
slightly more likely. It is not known whether there is an actual bug.
This came up while diagnosing MDEV-18879 in MariaDB 10.3.
parent a77e2668
......@@ -957,7 +957,7 @@ row_ins_foreign_fill_virtual(
upd_field_t* upd_field;
dict_vcol_set* v_cols = foreign->v_cols;
update->old_vrow = row_build(
ROW_COPY_POINTERS, index, rec,
ROW_COPY_DATA, index, rec,
offsets, index->table, NULL, NULL,
&ext, cascade->heap);
n_diff = update->n_fields;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment