Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions mysql-test/suite/rpl/r/versioning_row_virtual_text_blob.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include/master-slave.inc
[connection master]
CREATE OR REPLACE TABLE t (a TEXT, v BLOB AS (a) VIRTUAL)
WITH SYSTEM VERSIONING AS SELECT 'foo' AS a;
UPDATE t SET a='bar';
CREATE OR REPLACE TABLE t (a TEXT, v TEXT AS (RIGHT(a, 1)) VIRTUAL)
WITH SYSTEM VERSIONING AS SELECT 'before' AS a;
UPDATE t SET a='after';
connection slave;
SELECT * FROM t;
v a
r after
connection master;
DROP TABLE t;
include/rpl_end.inc
30 changes: 30 additions & 0 deletions mysql-test/suite/rpl/t/versioning_row_virtual_text_blob.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--source include/have_binlog_format_row.inc
--source include/master-slave.inc


# MDEV-24646 ASAN heap-use-after-free in Field_blob::pack /
# THD::binlog_update_row upon DML on table with virtual column

CREATE OR REPLACE TABLE t (a TEXT, v BLOB AS (a) VIRTUAL)
WITH SYSTEM VERSIONING AS SELECT 'foo' AS a;

UPDATE t SET a='bar';


# MDEV-39711 UPDATE on System-Versioned Tables uses the after-value in Row-
# format Binlog's before-image for non-trivial Text/Blob Virtual Columns

CREATE OR REPLACE TABLE t (a TEXT, v TEXT AS (RIGHT(a, 1)) VIRTUAL)
WITH SYSTEM VERSIONING AS SELECT 'before' AS a;

UPDATE t SET a='after';

--sync_slave_with_master
SELECT * FROM t;
--connection master


# Cleanup
DROP TABLE t;

--source include/rpl_end.inc
2 changes: 1 addition & 1 deletion sql/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9422,7 +9422,7 @@ bool TABLE::vers_update_fields()
}

if (vfield)
update_virtual_fields(file, VCOL_UPDATE_FOR_READ);
update_virtual_fields(file, VCOL_UPDATE_FOR_WRITE);
return res;
}

Expand Down