diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-02-15 12:24:34 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-02-15 12:24:34 +0200 |
commit | 0be5b450050965eccc82f31b9faac57e20e172c4 (patch) | |
tree | db142dbda415c146bd04fbe6a142115edb8b3bfe | |
parent | b3df194e31eb2e76a319d8d4195163df596447a6 (diff) | |
download | mariadb-git-bb-10.5-MDEV-24843.tar.gz |
MDEV-24843 Assertion rlen<llen failed when applying MEMSETbb-10.5-MDEV-24843
btr_cur_upd_rec_in_place(): Prefer WRITE to MEMSET for a single-byte
operation.
log_phys_t::apply(): Relax the assertion to allow a single-byte MEMSET.
-rw-r--r-- | mysql-test/suite/mariabackup/row_format_redundant.result | 14 | ||||
-rw-r--r-- | mysql-test/suite/mariabackup/row_format_redundant.test | 15 | ||||
-rw-r--r-- | storage/innobase/btr/btr0cur.cc | 13 | ||||
-rw-r--r-- | storage/innobase/log/log0recv.cc | 6 |
4 files changed, 43 insertions, 5 deletions
diff --git a/mysql-test/suite/mariabackup/row_format_redundant.result b/mysql-test/suite/mariabackup/row_format_redundant.result new file mode 100644 index 00000000000..7ff5e8654c6 --- /dev/null +++ b/mysql-test/suite/mariabackup/row_format_redundant.result @@ -0,0 +1,14 @@ +CREATE TABLE t1 (pk INT PRIMARY KEY, a YEAR UNSIGNED) ENGINE=InnoDB +ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (1,2021),(2,21),(3,0); +UPDATE t1 SET a = NULL; +# shutdown server +# remove datadir +# xtrabackup move back +# restart +SELECT * FROM t1; +pk a +1 NULL +2 NULL +3 NULL +DROP TABLE t1; diff --git a/mysql-test/suite/mariabackup/row_format_redundant.test b/mysql-test/suite/mariabackup/row_format_redundant.test new file mode 100644 index 00000000000..a77f1b9e493 --- /dev/null +++ b/mysql-test/suite/mariabackup/row_format_redundant.test @@ -0,0 +1,15 @@ +--source include/have_innodb.inc + +--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup + +CREATE TABLE t1 (pk INT PRIMARY KEY, a YEAR UNSIGNED) ENGINE=InnoDB +ROW_FORMAT=REDUNDANT; +INSERT INTO t1 VALUES (1,2021),(2,21),(3,0); +UPDATE t1 SET a = NULL; + +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +exec $XTRABACKUP --prepare --verbose --target-dir=$targetdir; +--source include/restart_and_restore.inc + +SELECT * FROM t1; +DROP TABLE t1; diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 9efa2d8f8bd..4050196c95d 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3,7 +3,7 @@ Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2015, 2020, MariaDB Corporation. +Copyright (c) 2015, 2021, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -4149,7 +4149,16 @@ void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index, } ut_ad(!index->table->not_redundant()); - if (ulint size = rec_get_nth_field_size(rec, n)) { + switch (ulint size = rec_get_nth_field_size(rec, n)) { + case 0: + break; + case 1: + mtr->write<1,mtr_t::MAYBE_NOP>( + *block, + rec_get_field_start_offs(rec, n) + rec, + 0U); + break; + default: mtr->memset( block, page_offset(rec_get_field_start_offs( diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index e7f5ef1e260..903b614a8e5 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2,7 +2,7 @@ Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2020, MariaDB Corporation. +Copyright (c) 2013, 2021, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -490,7 +490,7 @@ page_corrupted: llen= len; if ((b & 0x70) == MEMSET) { - ut_ad(rlen < llen); + ut_ad(rlen <= llen); if (UNIV_UNLIKELY(rlen != 1)) { size_t s; @@ -499,7 +499,7 @@ page_corrupted: memcpy(frame + last_offset + s, l, llen - s); } else - memset(frame + last_offset, *l, llen); + memset(frame + last_offset, *l, llen); goto next_after_applying_write; } const size_t slen= mlog_decode_varint_length(*l); |