mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-21892: Assertion ...row_get_rec_trx_id... failed on SELECT
btr_cur_upd_rec_in_place(): Invoke page_zip_rec_set_deleted()
for ROW_FORMAT=COMPRESSED pages, so that the change will be
written to the redo log.
This part of crash recovery was broken in
commit 08ba388713
(MDEV-12353).
This commit is contained in:
parent
57c592f74d
commit
adb4117631
3 changed files with 47 additions and 9 deletions
|
@ -1,3 +1,14 @@
|
|||
FLUSH TABLES;
|
||||
#
|
||||
# MDEV-21892 Assertion 'index != clust_index || row_get_rec_trx_id()'
|
||||
#
|
||||
connect con1,localhost,root;
|
||||
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
BEGIN;
|
||||
UPDATE t1 SET pk=1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
connection default;
|
||||
#
|
||||
# MDEV-12720 recovery fails with "Generic error"
|
||||
# for ROW_FORMAT=compressed
|
||||
|
@ -12,6 +23,12 @@ insert into a select null, uuid() from a a, a b, a c;
|
|||
SET GLOBAL innodb_flush_log_at_trx_commit=1;
|
||||
COMMIT;
|
||||
# restart
|
||||
disconnect con1;
|
||||
SELECT * FROM t1;
|
||||
pk
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
SELECT COUNT(*) from a;
|
||||
COUNT(*)
|
||||
1010
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
--source include/innodb_page_size_small.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--disable_query_log
|
||||
# This test kills the server, which could corrupt some mysql.* tables
|
||||
# that are not created with ENGINE=InnoDB.
|
||||
# Flush any non-InnoDB tables to prevent that from happening.
|
||||
FLUSH TABLES;
|
||||
--enable_query_log
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-21892 Assertion 'index != clust_index || row_get_rec_trx_id()'
|
||||
--echo #
|
||||
connect (con1,localhost,root);
|
||||
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
BEGIN;
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t1 SET pk=1;
|
||||
connection default;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12720 recovery fails with "Generic error"
|
||||
|
@ -25,6 +34,9 @@ COMMIT;
|
|||
|
||||
--let $shutdown_timeout=0
|
||||
--source include/restart_mysqld.inc
|
||||
disconnect con1;
|
||||
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
SELECT COUNT(*) from a;
|
||||
DROP TABLE a;
|
||||
|
|
|
@ -4110,16 +4110,25 @@ void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index,
|
|||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
byte* info_bits = &rec[rec_offs_comp(offsets)
|
||||
? -REC_NEW_INFO_BITS
|
||||
: -REC_OLD_INFO_BITS];
|
||||
compile_time_assert(REC_INFO_BITS_SHIFT == 0);
|
||||
if ((*info_bits & REC_INFO_BITS_MASK) == update->info_bits) {
|
||||
} else if (UNIV_LIKELY_NULL(block->page.zip.data)) {
|
||||
static_assert(REC_INFO_BITS_SHIFT == 0, "compatibility");
|
||||
if (UNIV_LIKELY_NULL(block->page.zip.data)) {
|
||||
ut_ad(rec_offs_comp(offsets));
|
||||
byte* info_bits = &rec[-REC_NEW_INFO_BITS];
|
||||
const bool flip_del_mark = (*info_bits ^ update->info_bits)
|
||||
& REC_INFO_DELETED_FLAG;
|
||||
*info_bits &= ~REC_INFO_BITS_MASK;
|
||||
*info_bits |= update->info_bits;
|
||||
|
||||
if (flip_del_mark) {
|
||||
page_zip_rec_set_deleted(block, rec, update->info_bits
|
||||
& REC_INFO_DELETED_FLAG, mtr);
|
||||
}
|
||||
} else {
|
||||
mtr->write<1>(*block, info_bits,
|
||||
byte* info_bits = &rec[rec_offs_comp(offsets)
|
||||
? -REC_NEW_INFO_BITS
|
||||
: -REC_OLD_INFO_BITS];
|
||||
|
||||
mtr->write<1,mtr_t::OPT>(*block, info_bits,
|
||||
(*info_bits & ~REC_INFO_BITS_MASK)
|
||||
| update->info_bits);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue