mirror of
https://github.com/MariaDB/server.git
synced 2025-04-22 15:15:41 +02:00

- InnoDB fails to find the space id from the page0 of the tablespace. In that case, InnoDB can use doublewrite buffer to recover the page0 and write into the file. - buf_dblwr_t::init_or_load_pages(): Loads only the pages which are valid.(page lsn >= checkpoint). To do that, InnoDB has to open the redo log before system tablespace, read the latest checkpoint information. recv_dblwr_t::find_first_page(): 1) Iterate the doublewrite buffer pages and find the 0th page 2) Read the tablespace flags, space id from the 0th page. 3) Read the 1st, 2nd and 3rd page from tablespace file and compare the space id with the space id which is stored in doublewrite buffer. 4) If it matches then we can write into the file. 5) Return space which matches the pages from the file. SysTablespace::read_lsn_and_check_flags(): Remove the retry logic for validating the first page. After restoring the first page from doublewrite buffer, assign tablespace flags by reading the first page. recv_recovery_read_max_checkpoint(): Reads the maximum checkpoint information from log file recv_recovery_from_checkpoint_start(): Avoid reading the checkpoint header information from log file Datafile::validate_first_page(): Throw error in case of first page validation fails.
60 lines
1.6 KiB
Text
60 lines
1.6 KiB
Text
#
|
|
# MDEV-32242 innodb.doublewrite test case always is skipped
|
|
#
|
|
create table t1 (f1 int primary key, f2 blob) stats_persistent=0, engine=innodb;
|
|
start transaction;
|
|
insert into t1 values(1, repeat('#',12));
|
|
insert into t1 values(2, repeat('+',12));
|
|
insert into t1 values(3, repeat('/',12));
|
|
insert into t1 values(4, repeat('-',12));
|
|
insert into t1 values(5, repeat('.',12));
|
|
commit work;
|
|
SET GLOBAL innodb_fast_shutdown = 0;
|
|
# restart
|
|
connect dml,localhost,root,,;
|
|
XA START 'x';
|
|
insert into t1 values (6, repeat('%', @@innodb_page_size/2));
|
|
XA END 'x';
|
|
XA PREPARE 'x';
|
|
disconnect dml;
|
|
connection default;
|
|
flush table t1 for export;
|
|
# Kill the server
|
|
# restart
|
|
FOUND 1 /InnoDB: Restoring page \[page id: space=[1-9][0-9]*, page number=0\] of datafile/ in mysqld.1.err
|
|
FOUND 1 /InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=3\]/ in mysqld.1.err
|
|
XA ROLLBACK 'x';
|
|
check table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
select f1, f2 from t1;
|
|
f1 f2
|
|
1 ############
|
|
2 ++++++++++++
|
|
3 ////////////
|
|
4 ------------
|
|
5 ............
|
|
connect dml,localhost,root,,;
|
|
XA START 'x';
|
|
insert into t1 values (6, repeat('%', @@innodb_page_size/2));
|
|
XA END 'x';
|
|
XA PREPARE 'x';
|
|
disconnect dml;
|
|
connection default;
|
|
flush table t1 for export;
|
|
# Kill the server
|
|
# restart
|
|
FOUND 2 /InnoDB: Restoring page \[page id: space=[1-9][0-9]*, page number=0\] of datafile/ in mysqld.1.err
|
|
XA ROLLBACK 'x';
|
|
check table t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
select f1, f2 from t1;
|
|
f1 f2
|
|
1 ############
|
|
2 ++++++++++++
|
|
3 ////////////
|
|
4 ------------
|
|
5 ............
|
|
drop table t1;
|
|
# End of 10.5 tests
|