diff --git a/mysql-test/suite/innodb/r/virtual_debug.result b/mysql-test/suite/innodb/r/virtual_debug.result index 4e8bafcd46c..fa5ca423262 100644 --- a/mysql-test/suite/innodb/r/virtual_debug.result +++ b/mysql-test/suite/innodb/r/virtual_debug.result @@ -445,3 +445,15 @@ gc -1 COMMIT; DROP TABLE t2; +# +# Bug#26330279 - ASSERT ON ROW_PURGE_REMOVE_SEC_IF_POSS_LEAF| INNOBASE/ROW/ROW0PURGE.CC +# +SET GLOBAL innodb_purge_stop_now=ON; +CREATE TABLE t1 (col1 INT, +col2 VARCHAR(100), +col3 VARCHAR(80) GENERATED ALWAYS AS (SUBSTR(col2,1,70)), +PRIMARY KEY (col1), UNIQUE KEY uidx(col3(10))) ENGINE = InnoDB; +INSERT INTO t1(col1, col2) VALUES(1, CONCAT(1, REPEAT('z',90))); +REPLACE INTO t1(col1, col2) SELECT col1, col2 FROM t1; +SET GLOBAL innodb_purge_run_now=ON; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/virtual_debug.test b/mysql-test/suite/innodb/t/virtual_debug.test index 4a0417663c7..81005533e4e 100644 --- a/mysql-test/suite/innodb/t/virtual_debug.test +++ b/mysql-test/suite/innodb/t/virtual_debug.test @@ -542,3 +542,22 @@ CONNECTION default; COMMIT; DROP TABLE t2; + +--echo # +--echo # Bug#26330279 - ASSERT ON ROW_PURGE_REMOVE_SEC_IF_POSS_LEAF| INNOBASE/ROW/ROW0PURGE.CC +--echo # + +SET GLOBAL innodb_purge_stop_now=ON; +CREATE TABLE t1 (col1 INT, + col2 VARCHAR(100), + col3 VARCHAR(80) GENERATED ALWAYS AS (SUBSTR(col2,1,70)), + PRIMARY KEY (col1), UNIQUE KEY uidx(col3(10))) ENGINE = InnoDB; + +INSERT INTO t1(col1, col2) VALUES(1, CONCAT(1, REPEAT('z',90))); + +REPLACE INTO t1(col1, col2) SELECT col1, col2 FROM t1; + +SET GLOBAL innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc + +DROP TABLE t1; diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc index f26c8cfb8f2..8e99ed19bd2 100644 --- a/storage/innobase/row/row0vers.cc +++ b/storage/innobase/row/row0vers.cc @@ -747,8 +747,21 @@ row_vers_vc_matches_cluster( field2->len = ind_field->prefix_len; } - /* The index field mismatch */ - if (v_heap + /* For multi-byte character sets (like utf8mb4) + and index on prefix of varchar vcol, we log + prefix_len * mbmaxlen bytes but the actual + secondaary index record size can be less than + that. For comparision, use actual length of + secondary index record */ + uint8_t mbmax_len = + DATA_MBMAXLEN(field2->type.mbminmaxlen); + if (ind_field->prefix_len != 0 && + !dfield_is_null(field2) && mbmax_len > 1) { + field2->len = field1->len; + } + + /* The index field mismatch */ + if (v_heap || cmp_dfield_dfield(field2, field1) != 0) { if (v_heap) { dtuple_dup_v_fld(*vrow, v_heap);