mariadb/mysql-test/suite/rpl/t/rpl_mdev38734.test
Kristian Nielsen ccee665272 MDEV-38734: Virtual columns wrongly included in binlog_row_image=MINIMAL
The original symptom of this was an assertion 'marked_for_read()' failing in
RBR with unique blobs and binlog_row_image=MINIMAL. The problem was that the
hidden DB_ROW_HASH_1 virtual column was included in the after-image of the
update, but the underlying blob column was not being updated, so it was not
in the read_set/write_set.

It seems clearly wrong to include the DB_ROW_HASH_1 in the after-image when
the underlying blob isn't even being updated. The cause of this is the
following commit:

Author: Monty <monty@mariadb.org>
Date:   Wed May 23 22:42:29 2018 +0300

    MDEV-15243 Crash with virtual fields and row based binary logging

That patch removed a check for if the underlying fields of a virtual column
were being updated, and just added them unconditionally. This seems wrong.

So revert that part of the commit, restoring the logic to only add a virtual
column if any underlying field is actually in the write_set.

Also fix a typo in that commit where a code reformat accidentally reversed a
condition.

Also fix an assertion when InnoDB goes to update secondary indexes: If any
part of the primary key is being updated, then add all virtual columns that
are part of secondary indexes to the read_set.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2026-02-03 12:51:19 +01:00

21 lines
568 B
Text

--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--connection slave
SET @row_image_save = @@global.binlog_row_image;
SET GLOBAL binlog_row_image=MINIMAL;
--source include/stop_slave.inc
--source include/start_slave.inc
--connection master
SET binlog_row_image=MINIMAL;
CREATE TABLE t (pk int primary key, a text, b text, unique(b));
INSERT INTO t VALUES (1,'foo', 'bar');
UPDATE t SET a = 'baz';
--sync_slave_with_master
SET GLOBAL binlog_row_image = @row_image_save;
--connection master
DROP TABLE t;
--source include/rpl_end.inc