| 1 |
--source include/have_debug.inc |
| 2 |
|
| 3 |
CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd' ENGINE=InnoDB ENCRYPTION='Y'; |
| 4 |
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 BLOB) TABLESPACE=ts1 ENCRYPTION='Y' ENGINE=InnoDB; |
| 5 |
|
| 6 |
SELECT NAME, ENCRYPTION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES where NAME='ts1'; |
| 7 |
SHOW CREATE TABLE t1; |
| 8 |
|
| 9 |
# Slow shutdown and restart to make sure ibuf merge is finished |
| 10 |
SET GLOBAL innodb_fast_shutdown = 0; |
| 11 |
--source include/restart_mysqld.inc |
| 12 |
|
| 13 |
--echo # Wait for purge to complete |
| 14 |
--source include/wait_innodb_all_purged.inc |
| 15 |
|
| 16 |
START TRANSACTION; |
| 17 |
INSERT INTO t1 VALUES(1, repeat('#',12)); |
| 18 |
INSERT INTO t1 VALUES(2, repeat('+',12)); |
| 19 |
INSERT INTO t1 VALUES(3, repeat('/',12)); |
| 20 |
INSERT INTO t1 VALUES(4, repeat('-',12)); |
| 21 |
INSERT INTO t1 VALUES(5, repeat('.',12)); |
| 22 |
COMMIT WORK; |
| 23 |
|
| 24 |
--echo # Ensure that dirty pages of table t1 is flushed. |
| 25 |
FLUSH TABLES t1 FOR EXPORT; |
| 26 |
UNLOCK TABLES; |
| 27 |
|
| 28 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 29 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 30 |
|
| 31 |
SET SESSION innodb_interpreter = 'init'; |
| 32 |
|
| 33 |
--echo # Check if the DBLWR files contain encrypted pages. |
| 34 |
SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages'; |
| 35 |
SELECT @@session.innodb_interpreter_output; |
| 36 |
|
| 37 |
SET SESSION innodb_interpreter = 'open_table test/t1'; |
| 38 |
SET SESSION innodb_interpreter = 'find_space_id test/t1'; |
| 39 |
SELECT @@session.innodb_interpreter_output INTO @space_id; |
| 40 |
|
| 41 |
SET SESSION innodb_interpreter = 'find_root_page_no test/t1'; |
| 42 |
SELECT @@session.innodb_interpreter_output INTO @page_no; |
| 43 |
|
| 44 |
SET @cmd = CONCAT('find_ondisk_page_type ', @space_id, ' ', @page_no); |
| 45 |
SET SESSION innodb_interpreter = @cmd; |
| 46 |
SELECT @@session.innodb_interpreter_output INTO @page_type; |
| 47 |
SELECT @page_type; |
| 48 |
|
| 49 |
SET SESSION innodb_interpreter = 'find_tablespace_file_name ts1'; |
| 50 |
SELECT @@session.innodb_interpreter_output INTO @space_file_name; |
| 51 |
|
| 52 |
SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size ts1'; |
| 53 |
SELECT @@session.innodb_interpreter_output INTO @space_page_size; |
| 54 |
|
| 55 |
SET SESSION innodb_interpreter = 'destroy'; |
| 56 |
|
| 57 |
let MYSQLD_DATADIR=`SELECT @@datadir`; |
| 58 |
let PAGE_NO=`select @page_no`; |
| 59 |
let FILE_NAME=`select @space_file_name`; |
| 60 |
let PAGE_SIZE=`select @space_page_size`; |
| 61 |
|
| 62 |
START TRANSACTION; |
| 63 |
INSERT INTO t1 VALUES(6, repeat('?',12)); |
| 64 |
|
| 65 |
SET GLOBAL innodb_log_flush_now = ON; |
| 66 |
|
| 67 |
--source include/kill_mysqld.inc |
| 68 |
|
| 69 |
--echo # Corrupt the root page of table t1 in the user tablespace. |
| 70 |
perl; |
| 71 |
use IO::Handle; |
| 72 |
my $fname= "$ENV{'MYSQLD_DATADIR'}/$ENV{'FILE_NAME'}"; |
| 73 |
my $nbytes = $ENV{'PAGE_NO'} * $ENV{'PAGE_SIZE'}; |
| 74 |
open(FILE, "+<", $fname) or die; |
| 75 |
FILE->autoflush(1); |
| 76 |
binmode FILE; |
| 77 |
seek(FILE, $nbytes, SEEK_SET); |
| 78 |
print FILE chr(0) x 38; |
| 79 |
close FILE; |
| 80 |
EOF |
| 81 |
|
| 82 |
--source include/start_mysqld.inc |
| 83 |
|
| 84 |
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 85 |
let SEARCH_PATTERN= Double write file has encrypted pages; |
| 86 |
--source include/search_pattern.inc |
| 87 |
|
| 88 |
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 89 |
let SEARCH_PATTERN= \\[Note\\] \\[MY-\\d+\\] \\[InnoDB\\] Recovered page \\[page id: space=\\d+, page number=\\d+\\] from the doublewrite buffer; |
| 90 |
--source include/search_pattern.inc |
| 91 |
|
| 92 |
CHECK TABLE t1; |
| 93 |
SELECT f1, f2 FROM t1; |
| 94 |
|
| 95 |
DROP TABLE t1; |
| 96 |
DROP TABLESPACE ts1; |
| 97 |
--echo # Test End |