From 1265bfc30d5bd692caecc65e6df3a19491949d0d Mon Sep 17 00:00:00 2001 From: Anway Durge <124391429+itzanway@users.noreply.github.com> Date: Tue, 10 Mar 2026 22:42:40 +0530 Subject: [PATCH] MDEV-38899 Fix Assertion \!((f->flags & 4096U) && f->vcol_info)\ upon RBR with NOBLOB Problem: When using Row-Based Replication (RBR) with binlog_row_image = NOBLOB, operations on a table with a UNIQUE constraint on a BLOB NOT NULL column cause a debug assertion failure in prepare_record() on the replica. A UNIQUE index on a BLOB creates a hidden virtual column (to store the blob's hash). This hidden virtual column inherits the NOT NULL property and receives the NO_DEFAULT_VALUE_FLAG (4096U). During replication, if the blob isn't included in the row image, prepare_record() evaluates missing columns and hits the overly strict assertion. Solution: Virtual columns evaluate their own expressions and do not use the default value mechanism. It is completely valid for them (especially automatically generated hidden ones) to have NO_DEFAULT_VALUE_FLAG set. Removed the invalid assertion: DBUG_ASSERT(!((f->flags & NO_DEFAULT_VALUE_FLAG) && f->vcol_info)); Added an MTR test case to prevent future regressions. --- .../suite/rpl/r/rpl_noblob_unique_blob.result | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 mysql-test/suite/rpl/r/rpl_noblob_unique_blob.result diff --git a/mysql-test/suite/rpl/r/rpl_noblob_unique_blob.result b/mysql-test/suite/rpl/r/rpl_noblob_unique_blob.result new file mode 100644 index 0000000000000..ae8c879ddf061 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_noblob_unique_blob.result @@ -0,0 +1,20 @@ +include/master-slave.inc +[connection master] +# +# MDEV-38899 Assertion !((f->flags & 4096U) && f->vcol_info) +# upon RBR with NOBLOB and unique blob +# +SET binlog_row_image = NOBLOB; +CREATE TABLE t (pk INT PRIMARY KEY, a BLOB NOT NULL, UNIQUE(a)); +INSERT IGNORE INTO t (pk) VALUES (1),(2); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +Warning 1062 Duplicate entry '' for key 'a' +include/sync_slave_sql_with_master.inc +# Verify data on slave +SELECT pk FROM t ORDER BY pk; +pk +1 +[connection master] +DROP TABLE t; +include/rpl_end.inc \ No newline at end of file