1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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:
Marko Mäkelä
2019-04-03 16:10:20 +03:00
parent 7984ea80de
commit cad56fbaba
20 changed files with 179 additions and 183 deletions

View File

@ -10,39 +10,19 @@ connection default;
# Cleanly shutdown mysqld
disconnect con1;
# Corrupt FIL_PAGE_OFFSET in bug16720368.ibd,
# and update the checksum to the "don't care" value.
# and recompute innodb_checksum_algorithm=crc32
# Restart mysqld
# This will succeed after a clean shutdown, due to
# fil_open_single_table_tablespace(check_space_id=FALSE).
SELECT COUNT(*) FROM bug16720368;
COUNT(*)
8
ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine
INSERT INTO bug16720368 VALUES(1);
ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine
INSERT INTO bug16720368_1 VALUES(1);
# The table is unaccessible, because after a crash we will
# validate the tablespace header.
SELECT COUNT(*) FROM bug16720368;
ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine
INSERT INTO bug16720368 VALUES(0,1);
ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine
# The table is readable thanks to innodb-force-recovery.
SELECT COUNT(*) FROM bug16720368;
COUNT(*)
8
INSERT INTO bug16720368 VALUES(0,1);
# Shut down the server cleanly to hide the corruption.
# The table is accessible, because after a clean shutdown we will
# NOT validate the tablespace header.
# We can modify the existing pages, but we cannot allocate or free
# any pages, because that would hit the corruption on page 0.
SELECT COUNT(*) FROM bug16720368;
COUNT(*)
9
# Shut down the server to uncorrupt the data.
# Restart the server after uncorrupting the file.
INSERT INTO bug16720368 VALUES(9,1);
SELECT COUNT(*) FROM bug16720368;
COUNT(*)
10
9
DROP TABLE bug16720368, bug16720368_1;
#
# Bug#16735660 ASSERT TABLE2 == NULL, ROLLBACK OF RESURRECTED TXNS,