From 2a89a028288ddf78b0ac47e56f5b8d37251b211f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Smutn=C3=BD?= Date: Thu, 18 Dec 2025 16:13:17 +0100 Subject: [PATCH] fsp0fsp.cc: log unexpected table in sys tablespace Fix log message about unexpected table in system tablespace as the current message can be missleading due to still existing (but already deprecated) system tables SYS_DATAFILES and SYS_TABLESPACES, reported in - MDEV-38412 Also adding the informative message with table name of the unexpected table in system table space. --- mysql-test/suite/innodb/r/sys_defragment_fail.result | 3 ++- mysql-test/suite/innodb/t/sys_defragment_fail.test | 4 +++- storage/innobase/fsp/fsp0fsp.cc | 10 +++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/innodb/r/sys_defragment_fail.result b/mysql-test/suite/innodb/r/sys_defragment_fail.result index 90735538fa350..bf418396ee05b 100644 --- a/mysql-test/suite/innodb/r/sys_defragment_fail.result +++ b/mysql-test/suite/innodb/r/sys_defragment_fail.result @@ -17,7 +17,8 @@ INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096; DROP TABLE t2; InnoDB 0 transactions not purged # restart -FOUND 1 /InnoDB: User table exists in the system tablespace/ in mysqld.1.err +FOUND 1 /InnoDB: Found unexpected table in system tablespace: test\/t1/ in mysqld.1.err +FOUND 1 /InnoDB: Unexpected table exists in the system tablespace/ in mysqld.1.err DROP TABLE t1; InnoDB 0 transactions not purged # restart: --debug_dbug=+d,fail_after_level_defragment diff --git a/mysql-test/suite/innodb/t/sys_defragment_fail.test b/mysql-test/suite/innodb/t/sys_defragment_fail.test index 4800e2619cb03..aca741b902163 100644 --- a/mysql-test/suite/innodb/t/sys_defragment_fail.test +++ b/mysql-test/suite/innodb/t/sys_defragment_fail.test @@ -29,7 +29,9 @@ let $restart_parameters=; --source include/restart_mysqld.inc let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; -let SEARCH_PATTERN=InnoDB: User table exists in the system tablespace; +let SEARCH_PATTERN=InnoDB: Found unexpected table in system tablespace: test\/t1; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=InnoDB: Unexpected table exists in the system tablespace; --source include/search_pattern_in_file.inc DROP TABLE t1; diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index d537b4478e735..1fa03e2099894 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -5723,6 +5723,14 @@ static dberr_t user_tables_exists() noexcept goto corrupt; if (!dict_sys.is_sys_table(mach_read_from_8(field))) { + const byte *name_field = rec_get_nth_field_old( + rec, DICT_FLD__SYS_TABLES__NAME, &len); + if (len != UNIV_SQL_NULL && len > 0) + { + sql_print_information( + "InnoDB: Found unexpected table in system tablespace: %.*s", + (int)len, (const char *)name_field); + } err= DB_SUCCESS_LOCKED_REC; btr_pcur_close(&pcur); goto func_exit; @@ -5740,7 +5748,7 @@ dberr_t fil_space_t::defragment() noexcept if (err == DB_SUCCESS_LOCKED_REC) { sql_print_information( - "InnoDB: User table exists in the system tablespace." + "InnoDB: Unexpected table exists in the system tablespace." "Please try to move the data from system tablespace " "to separate tablespace before defragment the " "system tablespace.");