| 1 |
--source include/have_debug.inc |
| 2 |
--source include/not_valgrind.inc |
| 3 |
--source include/have_innodb_16k.inc |
| 4 |
--source include/have_punch_hole.inc |
| 5 |
|
| 6 |
--echo # |
| 7 |
--echo # WL#13775 - InnoDB: Encrypt DBLWR files |
| 8 |
--echo # |
| 9 |
|
| 10 |
--echo # |
| 11 |
--echo # Test Begin: Test if recovery works if first page of user |
| 12 |
--echo # tablespace is corrupted. Valid copy of that page is there |
| 13 |
--echo # in DBLWR file. |
| 14 |
--echo # |
| 15 |
|
| 16 |
--disable_query_log |
| 17 |
call mtr.add_suppression("A bad Space ID was found in datafile"); |
| 18 |
call mtr.add_suppression("\\[ERROR\\] .* Space ID in fsp header is \\d+, but in the page header it is \\d+"); |
| 19 |
call mtr.add_suppression("Header page contains inconsistent data in datafile"); |
| 20 |
--enable_query_log |
| 21 |
|
| 22 |
# Slow shutdown and restart to make sure ibuf merge is finished |
| 23 |
SET GLOBAL innodb_fast_shutdown = 0; |
| 24 |
--source include/restart_mysqld.inc |
| 25 |
|
| 26 |
SET SESSION innodb_interpreter = 'init'; |
| 27 |
SET SESSION innodb_interpreter = 'buf_flush_sync_all_buf_pools'; |
| 28 |
|
| 29 |
|
| 30 |
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 BLOB) COMPRESSION='lz4' ENCRYPTION='Y'; |
| 31 |
SHOW CREATE TABLE t1; |
| 32 |
|
| 33 |
START TRANSACTION; |
| 34 |
INSERT INTO t1 VALUES(1, repeat('#',12)); |
| 35 |
INSERT INTO t1 VALUES(2, repeat('+',12)); |
| 36 |
INSERT INTO t1 VALUES(3, repeat('/',12)); |
| 37 |
INSERT INTO t1 VALUES(4, repeat('-',12)); |
| 38 |
INSERT INTO t1 VALUES(5, repeat('.',12)); |
| 39 |
COMMIT WORK; |
| 40 |
|
| 41 |
--echo # Wait for purge to complete |
| 42 |
--source include/wait_innodb_all_purged.inc |
| 43 |
|
| 44 |
--echo # Ensure that dirty pages of table t1 is flushed. |
| 45 |
FLUSH TABLES t1 FOR EXPORT; |
| 46 |
UNLOCK TABLES; |
| 47 |
|
| 48 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 49 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 50 |
|
| 51 |
BEGIN; |
| 52 |
INSERT INTO t1 VALUES (6, repeat('%', 12)); |
| 53 |
|
| 54 |
SET SESSION innodb_interpreter = 'buf_flush_sync_all_buf_pools'; |
| 55 |
SET SESSION innodb_interpreter = 'open_table test/t1'; |
| 56 |
SET SESSION innodb_interpreter = 'find_space_id test/t1'; |
| 57 |
SELECT @@session.innodb_interpreter_output INTO @space_id; |
| 58 |
|
| 59 |
SET @cmd = CONCAT('make_page_dirty ', @space_id, ' 0'); |
| 60 |
SET SESSION innodb_interpreter = @cmd; |
| 61 |
|
| 62 |
SET SESSION innodb_interpreter = 'corrupt_ondisk_page0 test/t1'; |
| 63 |
SET SESSION innodb_interpreter = 'destroy'; |
| 64 |
|
| 65 |
--source include/kill_and_restart_mysqld.inc |
| 66 |
|
| 67 |
SET SESSION innodb_interpreter = 'init'; |
| 68 |
SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages'; |
| 69 |
SET SESSION innodb_interpreter = 'destroy'; |
| 70 |
|
| 71 |
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 72 |
let SEARCH_PATTERN= Double write file has encrypted pages; |
| 73 |
--source include/search_pattern.inc |
| 74 |
|
| 75 |
let SEARCH_PATTERN=\\[Note\\] .* Restoring page \\[page id: space=\\d+, page number=0\\] of datafile .* from the doublewrite buffer. Writing .*; |
| 76 |
--source include/search_pattern.inc |
| 77 |
|
| 78 |
CHECK TABLE t1; |
| 79 |
SELECT f1, f2 FROM t1; |
| 80 |
|
| 81 |
DROP TABLE t1; |
| 82 |
--echo # Test End |