WL#14008: InnoDB: Make tablespace filename validation optional via --innodb-validate-tablespace-paths
Affects: Server-8.0
—
Status: Complete
By default we take a conservative/pessimistic approach. On startup we always check the path of all known table spaces against the information stored in the data dictionary. In case the user has moved files around. This can be very costly when the number of tablespace is high e.g., more than 100K. This WL introduces a new variable --innodb-validate-tablespace-paths := (ON | OFF) and the default will be ON to preserve existing behavior. In situations where we know that the user cannot move files around e.g. in a managed service we can set this variable to OFF. This reduces the startup time significantly.
FR1 - The tablespace path validation can be skipped using --innodb-validate- tablespace-paths=0 or --skip-innodb-validate-tablespace-paths FR2 - A [Note] message is logged in case tablespace path validation is skipped.
Introduce a new MySQL variable indicating whether InnoDB should check the tablespace paths in the data dictionary against the actual directories. Usage: [1] ./bin/mysqld --skip-innodb-validate-tablespace-paths [2] ./bin/mysqld --innodb-validate-tablespace-paths=0 In both examples InnoDB will log a Note message stating that the validation is disabled. ... [Note] [...] [InnoDB] Skipping InnoDB tablespace path validation. Manually moved tablespace files will not be detected! Since this is a [Note] it is only visible when log error verbosity is 3. When using this flag, InnoDB will not detect any files that get moved between different known directories. This should be used in environments where the user cannot move files around. As such, this is a desirable change for MySQLaaS as it provides a reduction in startup times.
1) Declare the new MYSQL_SYSVAR_BOOL in ha_innodb.cc - validate_tablespace_paths: static MYSQL_SYSVAR_BOOL( validate_tablespace_paths, srv_validate_tablespace_paths, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, "Enable validation of tablespace paths against the DD. (default: on)." " Disable with --skip-innodb-validate-tablespace-paths.", nullptr, nullptr, TRUE); 2) Declare the underlying bool (srv_validate_tablespace_paths) in srv0srv.h and define in srv0srv.cc: /** Whether to validate InnoDB tablespace paths on startup */ bool srv_validate_tablespace_paths = true; 4) Introduce new message in messages_to_error_log.txt: ER_IB_TABLESPACE_PATH_VALIDATION_SKIPPED eng "Skipping InnoDB tablespace path validation. Manually moved tablespace files will not be detected!" 3) In ha_innodb.cc, bool boot_tablespaces(THD *thd, size_t *moved_count) add a check before calling the validation code: if (srv_validate_tablespace_paths) { Validate_files validator; return (validator.validate(tablespaces, moved_count) != DB_SUCCESS); } ib::info(ER_IB_TABLESPACE_PATH_VALIDATION_SKIPPED); return false;
Copyright (c) 2000, 2025, Oracle Corporation and/or its affiliates. All rights reserved.