mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-36180 Doublewrite recovery of innodb_checksum_algorithm=full_crc32 page_compressed pages does not work
- InnoDB fails to recover the full crc32 page_compressed page from doublewrite buffer. The reason is that buf_dblwr_t::recover() fails to identify the space id from the page because the page has compressed from FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION bytes. Fix: === recv_dblwr_t::find_deferred_page(): Find the page which has the same page number and try to decompress/decrypt the page based on the tablespace metadata. After the decompression/decryption, compare the space id and write the recovered page back to the file. buf_page_t::read_complete(): Page read from disk is corrupted then try to read the page from deferred pages in doublewrite buffer.
This commit is contained in:
committed by
Sergei Golubchik
parent
19c4e1abe4
commit
a390aaaf23
@@ -12,8 +12,9 @@ let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
|
||||
let MYSQLD_DATADIR=`select @@datadir`;
|
||||
let ALGO=`select @@innodb_checksum_algorithm`;
|
||||
|
||||
create table t1 (f1 int primary key, f2 blob)page_compressed = 1 engine=innodb stats_persistent=0;
|
||||
create table t2(f1 int primary key, f2 blob)engine=innodb stats_persistent=0;
|
||||
create table t1 (f1 int primary key, f2 blob)page_compressed=1 engine=innodb encrypted=yes stats_persistent=0;
|
||||
create table t2(f1 int primary key, f2 blob)engine=innodb encrypted=yes stats_persistent=0;
|
||||
create table t3(f1 int primary key, f2 blob)page_compressed=1 engine=innodb encrypted=no stats_persistent=0;
|
||||
|
||||
start transaction;
|
||||
insert into t1 values(1, repeat('#',12));
|
||||
@@ -22,6 +23,7 @@ insert into t1 values(3, repeat('/',12));
|
||||
insert into t1 values(4, repeat('-',12));
|
||||
insert into t1 values(5, repeat('.',12));
|
||||
insert into t2 select * from t1;
|
||||
insert into t3 select * from t1;
|
||||
commit work;
|
||||
|
||||
# Slow shutdown and restart to make sure ibuf merge is finished
|
||||
@@ -33,12 +35,14 @@ let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_fl
|
||||
|
||||
select space into @t1_space_id from information_schema.innodb_sys_tablespaces where name='test/t1';
|
||||
select space into @t2_space_id from information_schema.innodb_sys_tablespaces where name='test/t2';
|
||||
select space into @t3_space_id from information_schema.innodb_sys_tablespaces where name='test/t3';
|
||||
|
||||
begin;
|
||||
insert into t1 values (6, repeat('%', 400));
|
||||
insert into t2 values (6, repeat('%', 400));
|
||||
insert into t3 values (6, repeat('%', 400));
|
||||
|
||||
# Copy the t1.ibd, t2.ibd file
|
||||
# Copy the t1.ibd, t2.ibd, t3.ibd file
|
||||
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup_1;
|
||||
--disable_result_log
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
|
||||
@@ -54,8 +58,11 @@ set global innodb_fil_make_page_dirty_debug = @t1_space_id;
|
||||
set global innodb_saved_page_number_debug = 3;
|
||||
set global innodb_fil_make_page_dirty_debug = @t2_space_id;
|
||||
|
||||
set global innodb_saved_page_number_debug = 3;
|
||||
set global innodb_fil_make_page_dirty_debug = @t3_space_id;
|
||||
|
||||
set global innodb_buf_flush_list_now = 1;
|
||||
--let CLEANUP_IF_CHECKPOINT=drop table t1, t2, unexpected_checkpoint;
|
||||
--let CLEANUP_IF_CHECKPOINT=drop table t1, t2, t3, unexpected_checkpoint;
|
||||
--source ../../suite/innodb/include/no_checkpoint_end.inc
|
||||
# Corrupt the page 3 in t1.ibd, t2.ibd file
|
||||
perl;
|
||||
@@ -103,6 +110,15 @@ binmode FILE;
|
||||
sysseek(FILE, 3*$page_size, 0);
|
||||
print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'});
|
||||
close FILE;
|
||||
|
||||
# Zero the complete page
|
||||
my $fname= "$ENV{'MYSQLD_DATADIR'}test/t3.ibd";
|
||||
open(FILE, "+<", $fname) or die;
|
||||
FILE->autoflush(1);
|
||||
binmode FILE;
|
||||
sysseek(FILE, 3*$page_size, 0);
|
||||
print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'});
|
||||
close FILE;
|
||||
EOF
|
||||
|
||||
# Successful recover from doublewrite buffer
|
||||
@@ -114,8 +130,10 @@ let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=[1-9]*, page number=
|
||||
|
||||
check table t1;
|
||||
check table t2;
|
||||
check table t3;
|
||||
select f1, f2 from t1;
|
||||
select f1, f2 from t2;
|
||||
select f1, f2 from t3;
|
||||
|
||||
SET GLOBAL innodb_fast_shutdown = 0;
|
||||
let $shutdown_timeout=;
|
||||
@@ -220,4 +238,4 @@ select * from t1;
|
||||
|
||||
--source ../../mariabackup/include/restart_and_restore.inc
|
||||
select * from t1;
|
||||
drop table t2, t1;
|
||||
drop table t3, t2, t1;
|
||||
|
Reference in New Issue
Block a user