mirror of
https://github.com/MariaDB/server.git
synced 2025-07-21 21:22:27 +03:00
If InnoDB crash recovery was needed, the InnoDB function srv_start() would invoke extra validation, reading something from every InnoDB data file. This should be unnecessary now that MDEV-14717 made RENAME operations crash-safe inside InnoDB (which can be disabled in MariaDB 10.2 by setting innodb_safe_truncate=OFF). dict_check_sys_tables(): Skip tables that would be dropped by row_mysql_drop_garbage_tables(). Perform extra validation only if innodb_safe_truncate=OFF, innodb_force_recovery=0 and crash recovery was needed. dict_load_table_one(): Validate the root page of the table. In this way, we can deny access to corrupted or mismatching tables not only after crash recovery, but also after a clean shutdown.
65 lines
2.6 KiB
Plaintext
65 lines
2.6 KiB
Plaintext
--source include/have_innodb.inc
|
|
-- source include/have_file_key_management_plugin.inc
|
|
# embedded does not support restart
|
|
-- source include/not_embedded.inc
|
|
|
|
#
|
|
# MDEV-11004: Unable to start (Segfault or os error 2) when encryption key missing
|
|
#
|
|
|
|
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
|
|
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
|
|
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1");
|
|
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
|
|
|
|
--echo # Start server with keys2.txt
|
|
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
|
|
-- source include/restart_mysqld.inc
|
|
|
|
CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19;
|
|
CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
|
|
CREATE TABLE t3(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=NO;
|
|
INSERT INTO t1(b) VALUES ('thisissecredmessage');
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t1(b) SELECT b FROM t1;
|
|
INSERT INTO t2 SELECT * FROM t1;
|
|
INSERT INTO t3 SELECT * FROM t1;
|
|
|
|
--echo
|
|
--echo # Restart server with keys3.txt
|
|
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
|
|
-- source include/restart_mysqld.inc
|
|
|
|
set global innodb_encryption_rotate_key_age = 1;
|
|
use test;
|
|
CREATE TABLE t4(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
|
|
SELECT SLEEP(5);
|
|
SELECT COUNT(1) FROM t3;
|
|
SELECT COUNT(1) FROM t2;
|
|
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
|
SELECT COUNT(1) FROM t2,t1 where t2.a = t1.a;
|
|
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
|
SELECT COUNT(1) FROM t1 where b = 'ab';
|
|
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
|
SELECT COUNT(1) FROM t1;
|
|
|
|
--echo
|
|
--echo # Start server with keys2.txt
|
|
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
|
|
-- source include/restart_mysqld.inc
|
|
|
|
SELECT COUNT(1) FROM t1;
|
|
SELECT COUNT(1) FROM t2;
|
|
SELECT COUNT(1) FROM t3;
|
|
|
|
DROP TABLE t1, t2, t3;
|