diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2023-03-03 19:05:44 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2023-03-06 23:40:13 +0530 |
commit | 062ba0bd4a2da1fc720c7da8feb3f179a9be1583 (patch) | |
tree | e021986d9d634b6f9e5acb25f7a31c14ec609659 | |
parent | 669a0c6efb89cd5df4eb117c9c44694a9fbeb52c (diff) | |
download | mariadb-git-062ba0bd4a2da1fc720c7da8feb3f179a9be1583.tar.gz |
MDEV-30183 Assertion `!memcmp(rec_trx_id, old_pk_trx_id->data, 6 + 7)' failed in row_log_table_apply_update
- This failure caused by commit 358921ce32203a9a8dd277a5ba7ac177c9e79e53
row_ins_duplicate_online() should consider if the record is an exact
match of the tuple when number of matching fields equals with number of
unique fields + DB_TRX_ID + DB_ROLL_PTR
-rw-r--r-- | mysql-test/suite/innodb/r/online_table_rebuild.result | 20 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/online_table_rebuild.test | 24 | ||||
-rw-r--r-- | storage/innobase/row/row0ins.cc | 2 |
3 files changed, 45 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/r/online_table_rebuild.result b/mysql-test/suite/innodb/r/online_table_rebuild.result index d4bddbc5305..46d9780decb 100644 --- a/mysql-test/suite/innodb/r/online_table_rebuild.result +++ b/mysql-test/suite/innodb/r/online_table_rebuild.result @@ -43,5 +43,25 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; +# +# MDEV-30183 Assertion `!memcmp(rec_trx_id, old_pk_trx_id->data, +# 6 + 7)' failed in row_log_table_apply_update +# +set @old_sql_mode = @@sql_mode; +set @@sql_mode=""; +CREATE TABLE t1(col_int int, col_varchar varchar(500))ENGINE=InnoDB; +INSERT INTO t1(col_int) values(2560); +set debug_sync="row_log_table_apply1_before SIGNAL con1_begin WAIT_FOR con1_commit"; +ALTER TABLE t1 ADD PRIMARY KEY ( col_varchar); +connection con1; +SET DEBUG_SYNC="now WAIT_FOR con1_begin"; +UPDATE t1 SET col_int = 2178; +INSERT INTO t1(col_int) VALUES(3016); +UPDATE t1 set col_int=2802; +SET DEBUG_SYNC="now SIGNAL con1_commit"; +connection default; +ERROR 23000: Duplicate entry '' for key 'PRIMARY' +DROP TABLE t1; +SET @@sql_mode = @old_sql_mode; disconnect con1; SET DEBUG_SYNC=reset; diff --git a/mysql-test/suite/innodb/t/online_table_rebuild.test b/mysql-test/suite/innodb/t/online_table_rebuild.test index 1d34738703c..02e9639eae2 100644 --- a/mysql-test/suite/innodb/t/online_table_rebuild.test +++ b/mysql-test/suite/innodb/t/online_table_rebuild.test @@ -59,5 +59,29 @@ connection default; reap; SHOW CREATE TABLE t1; DROP TABLE t1; + +--echo # +--echo # MDEV-30183 Assertion `!memcmp(rec_trx_id, old_pk_trx_id->data, +--echo # 6 + 7)' failed in row_log_table_apply_update +--echo # +set @old_sql_mode = @@sql_mode; +set @@sql_mode=""; +CREATE TABLE t1(col_int int, col_varchar varchar(500))ENGINE=InnoDB; +INSERT INTO t1(col_int) values(2560); +set debug_sync="row_log_table_apply1_before SIGNAL con1_begin WAIT_FOR con1_commit"; +send ALTER TABLE t1 ADD PRIMARY KEY ( col_varchar); + +connection con1; +SET DEBUG_SYNC="now WAIT_FOR con1_begin"; +UPDATE t1 SET col_int = 2178; +INSERT INTO t1(col_int) VALUES(3016); +UPDATE t1 set col_int=2802; +SET DEBUG_SYNC="now SIGNAL con1_commit"; + +connection default; +--error ER_DUP_ENTRY +reap; +DROP TABLE t1; +SET @@sql_mode = @old_sql_mode; disconnect con1; SET DEBUG_SYNC=reset; diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 3b21b0315cd..e327717ce65 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -2253,7 +2253,7 @@ row_ins_duplicate_online(ulint n_uniq, const dtuple_t *entry, ulint trx_id_len; - if (fields == n_uniq + if (fields == n_uniq + 2 && memcmp(rec_get_nth_field(rec, offsets, n_uniq, &trx_id_len), reset_trx_id, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN)) { ut_ad(trx_id_len == DATA_TRX_ID_LEN); |