Debian Codegraph @

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

raw
1 --source include/have_debug.inc
2 --source include/not_valgrind.inc
3
4 create table t1 (f1 int primary key, f2 blob) ENCRYPTION='Y';
5
6 START TRANSACTION;
7 INSERT INTO t1 VALUES(1, repeat('#',12));
8 INSERT INTO t1 VALUES(2, repeat('+',12));
9 INSERT INTO t1 VALUES(3, repeat('/',12));
10 INSERT INTO t1 VALUES(4, repeat('-',12));
11 INSERT INTO t1 VALUES(5, repeat('.',12));
12 COMMIT WORK;
13
14 --echo # Wait for purge to complete
15 --source include/wait_innodb_all_purged.inc
16
17 SET GLOBAL innodb_monitor_enable = module_log;
18
19 --echo # Ensure that dirty pages of table t1 is flushed.
20 FLUSH TABLES t1 FOR EXPORT;
21 UNLOCK TABLES;
22
23 SET GLOBAL innodb_master_thread_disabled_debug=1;
24 SET GLOBAL innodb_checkpoint_disabled = 1;
25
26 BEGIN;
27 INSERT INTO t1 VALUES (6, repeat('%', 12));
28
29 SET SESSION innodb_interpreter = 'init';
30 SET SESSION innodb_interpreter = 'open_table test/t1';
31
32 --echo # Identify the space_id of the given table.
33 SET SESSION innodb_interpreter = 'find_space_id test/t1';
34 SELECT @@session.innodb_interpreter_output INTO @space_id;
35
36 --echo # Find the root page number of the given table.
37 SET SESSION innodb_interpreter = 'find_root_page_no test/t1';
38 SELECT @@session.innodb_interpreter_output INTO @page_no;
39
40 --echo # Find the on-disk page type of the given page.
41 SET @cmd = CONCAT('find_ondisk_page_type ', @space_id, ' ', @page_no);
42 SET SESSION innodb_interpreter = @cmd;
43 SELECT @@session.innodb_interpreter_output INTO @page_type;
44 SELECT @page_type;
45
46 SET SESSION innodb_interpreter = 'find_tablespace_file_name test/t1';
47 SELECT @@session.innodb_interpreter_output INTO @space_file_name;
48
49 SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
50 SELECT @@session.innodb_interpreter_output INTO @space_page_size;
51
52 SET SESSION innodb_interpreter = 'destroy';
53
54 let MYSQLD_DATADIR=`SELECT @@datadir`;
55 let PAGE_NUM=`select @page_no`;
56 let FILE_NAME=`select @space_file_name`;
57 let INNODB_PAGE_SIZE=`select @space_page_size`;
58
59 # Wait till generated REDOs are synced to disk
60 --let $wait_condition = SELECT COUNT =(SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME = 'log_lsn_current') FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME = 'log_lsn_last_flush'
61 --source include/wait_condition.inc
62
63 --source include/kill_mysqld.inc
64
65 --echo # Corrupt the root page of table t1 in the user tablespace.
66 --let IBD_FILE=$MYSQLD_DATADIR/$FILE_NAME
67 --let ALL_ZEROES=0
68 --source ../include/corrupt_page.inc
69
70 --source include/start_mysqld.inc
71
72 SET SESSION innodb_interpreter = 'init';
73 SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
74 SET SESSION innodb_interpreter = 'destroy';
75
76 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
77 let SEARCH_PATTERN= Double write file has encrypted pages;
78 --source include/search_pattern.inc
79
80 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
81 let SEARCH_PATTERN= \\[Note\\] \\[MY-\\d+\\] \\[InnoDB\\] Recovered page \\[page id: space=\\d+, page number=\\d+\\] from the doublewrite buffer;
82 --source include/search_pattern.inc
83
84 CHECK TABLE t1;
85 SELECT f1, f2 FROM t1;
86
87 DROP TABLE t1;
88 --echo # Test End