Skip to content
Permalink
Browse files
MDEV-18981 Possible corruption when using FOREIGN KEY with virtual co…
…lumns

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.
  • Loading branch information
dr-m committed Mar 20, 2019
1 parent a77e266 commit 630199e
Showing 1 changed file with 1 addition and 1 deletion.
@@ -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;

0 comments on commit 630199e

Please sign in to comment.