mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-18733 MariaDB slow start after crash recovery
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.
This commit is contained in:
@ -13,6 +13,7 @@ call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]
|
||||
# Suppression for builds where file_key_management plugin is linked statically
|
||||
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
|
||||
call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded\\.");
|
||||
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
|
||||
|
||||
--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
|
||||
--source include/restart_mysqld.inc
|
||||
@ -26,11 +27,11 @@ INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
|
||||
--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
--error ER_GET_ERRMSG
|
||||
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
||||
SELECT * FROM t1;
|
||||
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
|
||||
SHOW WARNINGS;
|
||||
--error ER_GET_ERRMSG
|
||||
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
||||
ALTER TABLE t1 ENGINE=InnoDB;
|
||||
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
|
||||
SHOW WARNINGS;
|
||||
@ -57,8 +58,7 @@ UNLOCK TABLES;
|
||||
--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
# Discard should pass even with incorrect keys
|
||||
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
|
||||
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
|
||||
perl;
|
||||
@ -71,19 +71,23 @@ EOF
|
||||
--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
|
||||
perl;
|
||||
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
|
||||
ib_discard_tablespaces("test", "t1");
|
||||
ib_restore_tablespaces("test", "t1");
|
||||
EOF
|
||||
|
||||
ALTER TABLE t1 IMPORT TABLESPACE;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--let $restart_parameters= --innodb-encrypt-tables --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
# Rename table should pass even with incorrect keys
|
||||
--error ER_ERROR_ON_RENAME
|
||||
RENAME TABLE t1 TO t1new;
|
||||
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
|
||||
|
||||
# Alter table rename is not allowed with incorrect keys
|
||||
--error ER_GET_ERRMSG
|
||||
ALTER TABLE t1new RENAME TO t2new;
|
||||
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
||||
ALTER TABLE t1 RENAME TO t1new;
|
||||
# Drop should pass even with incorrect keys
|
||||
--replace_regex /(tablespace|key_id) [1-9][0-9]*/\1 /
|
||||
DROP TABLE t1new;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user