|
Many InnoDB data dictionary cache operations require that the table name be copied so that it will be NUL terminated. The table name that would be read from SYS_TABLES.NAME is not guaranteed to be NUL-terminated.
Let us refactor the code so that such unnecessary copying can be avoided and the table name can be passed as const span<const char>& to those functions that need it.
This will also change some error reporting, like this:
@@ -2314,8 +2317,10 @@ fil_ibd_open(
|
First, bail out if no tablespace files were found. */
|
if (valid_tablespaces_found == 0) {
|
os_file_get_last_error(true);
|
- ib::error() << "Could not find a valid tablespace file for `"
|
- << tablename << "`. " << TROUBLESHOOT_DATADICT_MSG;
|
+ sql_print_error("InnoDB: Could not find a valid tablespace"
|
+ " file for %.*s. %s",
|
+ static_cast<int>(name.size()), name.data(),
|
+ TROUBLESHOOT_DATADICT_MSG);
|
goto corrupted;
|
}
|
if (!validate) {
|
The user-visible change is that instead of a string like `test`.`t1` the internal name `test/t1` will be reported.
|