Commit adb41176 authored by Marko Mäkelä's avatar Marko Mäkelä

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 08ba3887 (MDEV-12353).
parent 57c592f7
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" # MDEV-12720 recovery fails with "Generic error"
# for ROW_FORMAT=compressed # for ROW_FORMAT=compressed
...@@ -12,6 +23,12 @@ insert into a select null, uuid() from a a, a b, a c; ...@@ -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; SET GLOBAL innodb_flush_log_at_trx_commit=1;
COMMIT; COMMIT;
# restart # restart
disconnect con1;
SELECT * FROM t1;
pk
1
2
DROP TABLE t1;
SELECT COUNT(*) from a; SELECT COUNT(*) from a;
COUNT(*) COUNT(*)
1010 1010
......
--source include/innodb_page_size_small.inc --source include/innodb_page_size_small.inc
--source include/not_embedded.inc --source include/not_embedded.inc
--disable_query_log
# This test kills the server, which could corrupt some mysql.* tables # This test kills the server, which could corrupt some mysql.* tables
# that are not created with ENGINE=InnoDB. # that are not created with ENGINE=InnoDB.
# Flush any non-InnoDB tables to prevent that from happening. # Flush any non-InnoDB tables to prevent that from happening.
FLUSH TABLES; 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 #
--echo # MDEV-12720 recovery fails with "Generic error" --echo # MDEV-12720 recovery fails with "Generic error"
...@@ -25,6 +34,9 @@ COMMIT; ...@@ -25,6 +34,9 @@ COMMIT;
--let $shutdown_timeout=0 --let $shutdown_timeout=0
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
disconnect con1;
SELECT * FROM t1;
DROP TABLE t1;
SELECT COUNT(*) from a; SELECT COUNT(*) from a;
DROP TABLE a; DROP TABLE a;
...@@ -4110,16 +4110,25 @@ void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index, ...@@ -4110,16 +4110,25 @@ void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index,
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
byte* info_bits = &rec[rec_offs_comp(offsets) static_assert(REC_INFO_BITS_SHIFT == 0, "compatibility");
? -REC_NEW_INFO_BITS if (UNIV_LIKELY_NULL(block->page.zip.data)) {
: -REC_OLD_INFO_BITS]; ut_ad(rec_offs_comp(offsets));
compile_time_assert(REC_INFO_BITS_SHIFT == 0); byte* info_bits = &rec[-REC_NEW_INFO_BITS];
if ((*info_bits & REC_INFO_BITS_MASK) == update->info_bits) { const bool flip_del_mark = (*info_bits ^ update->info_bits)
} else if (UNIV_LIKELY_NULL(block->page.zip.data)) { & REC_INFO_DELETED_FLAG;
*info_bits &= ~REC_INFO_BITS_MASK; *info_bits &= ~REC_INFO_BITS_MASK;
*info_bits |= update->info_bits; *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 { } 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) (*info_bits & ~REC_INFO_BITS_MASK)
| update->info_bits); | update->info_bits);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment