| 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("A bad Space ID was found 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("Header page contains inconsistent data in datafile"); |
| 18 |
call mtr.add_suppression("Checksum mismatch in datafile"); |
| 19 |
--enable_query_log |
| 20 |
|
| 21 |
SET GLOBAL innodb_monitor_enable = module_log; |
| 22 |
|
| 23 |
--echo # Wait for purge to complete |
| 24 |
--source include/wait_innodb_all_purged.inc |
| 25 |
|
| 26 |
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 BLOB); |
| 27 |
|
| 28 |
START TRANSACTION; |
| 29 |
INSERT INTO t1 VALUES(1, repeat('#',12)); |
| 30 |
INSERT INTO t1 VALUES(2, repeat('+',12)); |
| 31 |
INSERT INTO t1 VALUES(3, repeat('/',12)); |
| 32 |
INSERT INTO t1 VALUES(4, repeat('-',12)); |
| 33 |
INSERT INTO t1 VALUES(5, repeat('.',12)); |
| 34 |
COMMIT WORK; |
| 35 |
|
| 36 |
--echo # Ensure that dirty pages of table t1 is flushed. |
| 37 |
FLUSH TABLES t1 FOR EXPORT; |
| 38 |
UNLOCK TABLES; |
| 39 |
|
| 40 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 41 |
SET GLOBAL innodb_checkpoint_disabled=1; |
| 42 |
|
| 43 |
BEGIN; |
| 44 |
INSERT INTO t1 VALUES (6, repeat('%', 12)); |
| 45 |
|
| 46 |
SET SESSION innodb_interpreter = 'init'; |
| 47 |
|
| 48 |
SET SESSION innodb_interpreter = 'find_tablespace_file_name test/t1'; |
| 49 |
SELECT @@session.innodb_interpreter_output INTO @space_file_name; |
| 50 |
|
| 51 |
SET SESSION innodb_interpreter = 'destroy'; |
| 52 |
|
| 53 |
let MYSQLD_DATADIR=`SELECT @@datadir`; |
| 54 |
let FILE_NAME=`select @space_file_name`; |
| 55 |
let INNODB_PAGE_SIZE=`select @@innodb_page_size`; |
| 56 |
|
| 57 |
# Wait till generated REDOs are synced to disk |
| 58 |
--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' |
| 59 |
--source include/wait_condition.inc |
| 60 |
|
| 61 |
--source include/kill_mysqld.inc |
| 62 |
|
| 63 |
--echo # Corrupt the root page of table t1 in the user tablespace. |
| 64 |
--let IBD_FILE=$MYSQLD_DATADIR/$FILE_NAME |
| 65 |
--let PAGE_NUM="0" |
| 66 |
--let ALL_ZEROES=0 |
| 67 |
--source ../include/corrupt_page.inc |
| 68 |
|
| 69 |
--source include/start_mysqld.inc |
| 70 |
|
| 71 |
SET SESSION innodb_interpreter = 'init'; |
| 72 |
SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages'; |
| 73 |
SET SESSION innodb_interpreter = 'destroy'; |
| 74 |
|
| 75 |
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 76 |
let SEARCH_PATTERN= Double write file has encrypted pages; |
| 77 |
--source include/search_pattern.inc |
| 78 |
|
| 79 |
let SEARCH_PATTERN=\\[Note\\] .* Restoring page \\[page id: space=\\d+, page number=0\\] of datafile .* from the doublewrite buffer. Writing .*; |
| 80 |
--source include/search_pattern.inc |
| 81 |
|
| 82 |
CHECK TABLE t1; |
| 83 |
SELECT f1, f2 FROM t1; |
| 84 |
|
| 85 |
DROP TABLE t1; |
| 86 |
--echo # Test End |