| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_innodb_16k.inc |
| 3 |
--source include/have_punch_hole.inc |
| 4 |
|
| 5 |
--echo # |
| 6 |
--echo # WL#13775 - InnoDB: Encrypt DBLWR files |
| 7 |
--echo # |
| 8 |
|
| 9 |
--echo # Test scenario: |
| 10 |
--echo # Check if the DBLWR recovery works correctly for a page |
| 11 |
--echo # that is compressed and encrypted. |
| 12 |
|
| 13 |
create table t1 (f1 int primary key, f2 blob) COMPRESSION='lz4' ENCRYPTION='Y'; |
| 14 |
|
| 15 |
START TRANSACTION; |
| 16 |
INSERT INTO t1 VALUES(1, repeat('#',12)); |
| 17 |
INSERT INTO t1 VALUES(2, repeat('+',12)); |
| 18 |
INSERT INTO t1 VALUES(3, repeat('/',12)); |
| 19 |
INSERT INTO t1 VALUES(4, repeat('-',12)); |
| 20 |
INSERT INTO t1 VALUES(5, repeat('.',12)); |
| 21 |
COMMIT WORK; |
| 22 |
|
| 23 |
--echo # Ensure that dirty pages of table t1 is flushed. |
| 24 |
FLUSH TABLES t1 FOR EXPORT; |
| 25 |
UNLOCK TABLES; |
| 26 |
|
| 27 |
SET SESSION innodb_interpreter = 'init'; |
| 28 |
SET SESSION innodb_interpreter = 'open_table test/t1'; |
| 29 |
|
| 30 |
--echo # Identify the space_id of the given table. |
| 31 |
SET SESSION innodb_interpreter = 'find_space_id test/t1'; |
| 32 |
SELECT @@session.innodb_interpreter_output INTO @space_id; |
| 33 |
|
| 34 |
--echo # Find the root page number of the given table. |
| 35 |
SET SESSION innodb_interpreter = 'find_root_page_no test/t1'; |
| 36 |
SELECT @@session.innodb_interpreter_output INTO @page_no; |
| 37 |
|
| 38 |
--echo # Find the on-disk page type of the given page. |
| 39 |
SET @cmd = CONCAT('find_ondisk_page_type ', @space_id, ' ', @page_no); |
| 40 |
SET SESSION innodb_interpreter = @cmd; |
| 41 |
SELECT @@session.innodb_interpreter_output INTO @page_type; |
| 42 |
SELECT @page_type; |
| 43 |
|
| 44 |
SET SESSION innodb_interpreter = 'corrupt_ondisk_root_page test/t1'; |
| 45 |
SET SESSION innodb_interpreter = 'destroy'; |
| 46 |
|
| 47 |
--source include/kill_and_restart_mysqld.inc |
| 48 |
|
| 49 |
set global innodb_interpreter = 'init'; |
| 50 |
set global innodb_interpreter = 'print_dblwr_has_encrypted_pages'; |
| 51 |
set global innodb_interpreter = 'destroy'; |
| 52 |
|
| 53 |
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 54 |
let SEARCH_PATTERN= Double write file has encrypted pages; |
| 55 |
--source include/search_pattern.inc |
| 56 |
|
| 57 |
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 58 |
let SEARCH_PATTERN= \\[Note\\] \\[MY-\\d+\\] \\[InnoDB\\] Recovered page \\[page id: space=\\d+, page number=\\d+\\] from the doublewrite buffer; |
| 59 |
--source include/search_pattern.inc |
| 60 |
|
| 61 |
CHECK TABLE t1; |
| 62 |
SELECT f1, f2 FROM t1; |
| 63 |
|
| 64 |
DROP TABLE t1; |
| 65 |
--echo # Test End |