| 1 |
create table t1 (f1 int primary key, f2 blob) ENCRYPTION='Y'; |
| 2 |
START TRANSACTION; |
| 3 |
INSERT INTO t1 VALUES(1, repeat('#',12)); |
| 4 |
INSERT INTO t1 VALUES(2, repeat('+',12)); |
| 5 |
INSERT INTO t1 VALUES(3, repeat('/',12)); |
| 6 |
INSERT INTO t1 VALUES(4, repeat('-',12)); |
| 7 |
INSERT INTO t1 VALUES(5, repeat('.',12)); |
| 8 |
COMMIT WORK; |
| 9 |
# Wait for purge to complete |
| 10 |
SET GLOBAL innodb_monitor_enable = module_log; |
| 11 |
# Ensure that dirty pages of table t1 is flushed. |
| 12 |
FLUSH TABLES t1 FOR EXPORT; |
| 13 |
UNLOCK TABLES; |
| 14 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 15 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 16 |
BEGIN; |
| 17 |
INSERT INTO t1 VALUES (6, repeat('%', 12)); |
| 18 |
SET SESSION innodb_interpreter = 'init'; |
| 19 |
SET SESSION innodb_interpreter = 'open_table test/t1'; |
| 20 |
# Identify the space_id of the given table. |
| 21 |
SET SESSION innodb_interpreter = 'find_space_id test/t1'; |
| 22 |
SELECT @@session.innodb_interpreter_output INTO @space_id; |
| 23 |
# Find the root page number of the given table. |
| 24 |
SET SESSION innodb_interpreter = 'find_root_page_no test/t1'; |
| 25 |
SELECT @@session.innodb_interpreter_output INTO @page_no; |
| 26 |
# Find the on-disk page type of the given page. |
| 27 |
SET @cmd = CONCAT('find_ondisk_page_type ', @space_id, ' ', @page_no); |
| 28 |
SET SESSION innodb_interpreter = @cmd; |
| 29 |
SELECT @@session.innodb_interpreter_output INTO @page_type; |
| 30 |
SELECT @page_type; |
| 31 |
@page_type |
| 32 |
FIL_PAGE_ENCRYPTED |
| 33 |
SET SESSION innodb_interpreter = 'find_tablespace_file_name test/t1'; |
| 34 |
SELECT @@session.innodb_interpreter_output INTO @space_file_name; |
| 35 |
SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1'; |
| 36 |
SELECT @@session.innodb_interpreter_output INTO @space_page_size; |
| 37 |
SET SESSION innodb_interpreter = 'destroy'; |
| 38 |
# Kill the server |
| 39 |
# Corrupt the root page of table t1 in the user tablespace. |
| 40 |
# restart |
| 41 |
SET SESSION innodb_interpreter = 'init'; |
| 42 |
SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages'; |
| 43 |
SET SESSION innodb_interpreter = 'destroy'; |
| 44 |
Pattern "Double write file has encrypted pages" found |
| 45 |
Pattern "\[Note\] \[MY-\d+\] \[InnoDB\] Recovered page \[page id: space=\d+, page number=\d+\] from the doublewrite buffer" found |
| 46 |
CHECK TABLE t1; |
| 47 |
Table Op Msg_type Msg_text |
| 48 |
test.t1 check status OK |
| 49 |
SELECT f1, f2 FROM t1; |
| 50 |
f1 f2 |
| 51 |
1 ############ |
| 52 |
2 ++++++++++++ |
| 53 |
3 //////////// |
| 54 |
4 ------------ |
| 55 |
5 ............ |
| 56 |
DROP TABLE t1; |
| 57 |
# Test End |