diff --git a/mysql-test/suite/innodb/r/sys_defragment_fail.result b/mysql-test/suite/innodb/r/sys_defragment_fail.result index 90735538fa350..52d2e0a653fe3 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 \(space=0\): 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..2f5b19dd46c7d 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 \(space=0\): 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 7cd27126a734a..c184863f53993 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -5723,6 +5723,15 @@ 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" + "(space=0): %.*s", + (int)len, (const char *)name_field); + } err= DB_SUCCESS_LOCKED_REC; btr_pcur_close(&pcur); goto func_exit; @@ -5740,7 +5749,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.");