Debian Codegraph @

mysql-test/suite/innodb/t/dblwr_encrypt.test

raw
1 --source include/have_debug.inc
2 --source include/not_valgrind.inc
3
4 --echo #
5 --echo # WL#13775 - InnoDB: Encrypt DBLWR files
6 --echo #
7
8 --echo #
9 --echo # Test Begin: Test if recovery works if first page of user
10 --echo # tablespace is corrupted. Valid copy of that page is there
11 --echo # in DBLWR file.
12 --echo #
13
14 --disable_query_log
15 call mtr.add_suppression("Checksum mismatch in datafile");
16 call mtr.add_suppression("\\[ERROR\\] .* Space ID in fsp header is \\d+, but in the page header it is \\d+");
17 call mtr.add_suppression("\\[ERROR\\] .* A bad Space ID was found in datafile");
18 --enable_query_log
19
20 SET SESSION innodb_interpreter = 'init';
21
22 CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 BLOB) ENCRYPTION='Y';
23
24 START TRANSACTION;
25 INSERT INTO t1 VALUES(1, repeat('#',12));
26 INSERT INTO t1 VALUES(2, repeat('+',12));
27 INSERT INTO t1 VALUES(3, repeat('/',12));
28 COMMIT WORK;
29
30 SELECT space from INFORMATION_SCHEMA.INNODB_TABLESPACES
31 WHERE name = 'test/t1' INTO @space_id;
32
33 --echo # Ensure that dirty pages of table t1 is flushed.
34 FLUSH TABLES t1 FOR EXPORT;
35 UNLOCK TABLES;
36
37 SET SESSION innodb_interpreter = 'find_tablespace_file_name test/t1';
38 SELECT @@session.innodb_interpreter_output INTO @space_file_name;
39
40 SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
41 SELECT @@session.innodb_interpreter_output INTO @space_page_size;
42
43 let MYSQLD_DATADIR=`SELECT @@datadir`;
44 let PAGE_NO=0;
45 let FILE_NAME=`select @space_file_name`;
46 let PAGE_SIZE=`select @space_page_size`;
47
48 START TRANSACTION;
49 INSERT INTO t1 VALUES(4, repeat('.',12));
50
51 # Ensure that the desired page is available in the dblwr file.
52 SET SESSION innodb_interpreter = CONCAT('dblwr_force_crash ', @space_id, ' 0');
53 --source include/expect_crash.inc
54 --error 2013
55 SET SESSION innodb_interpreter = CONCAT('make_page_dirty ', @space_id, ' 0');
56
57 perl;
58 use IO::Handle;
59 my $fname= "$ENV{'MYSQLD_DATADIR'}/$ENV{'FILE_NAME'}";
60 my $page_size = $ENV{'PAGE_SIZE'};
61 my $nbytes = $ENV{'PAGE_NO'} * $ENV{'PAGE_SIZE'};
62 open(FILE, "+<", $fname) or die;
63 FILE->autoflush(1);
64 binmode FILE;
65 seek(FILE, $nbytes, SEEK_SET);
66 print FILE chr(0) x 38;
67 close FILE;
68 EOF
69
70 --source include/start_mysqld.inc
71
72 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
73 let SEARCH_PATTERN=\\[Note\\] .* Restoring page \\[page id: space=\\d+, page number=0\\] of datafile .* from the doublewrite buffer. Writing .*;
74 --source include/search_pattern.inc
75
76 CHECK TABLE t1;
77 SELECT f1, f2 FROM t1;
78
79 DROP TABLE t1;
80 --echo # Test End