Bug #82060 | mysqld will read dropped table when it start | ||
---|---|---|---|
Submitted: | 30 Jun 2016 2:55 | Modified: | 30 Jun 2016 7:04 |
Reporter: | h h | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S1 (Critical) |
Version: | 5.7.12, 5.7.13 | OS: | CentOS (CentOS release 6.5 (Final)) |
Assigned to: | CPU Architecture: | Any | |
Tags: | error |
[30 Jun 2016 2:55]
h h
[30 Jun 2016 3:10]
h h
when i do " use b;rename table a.table1 to table1 " ,and then restart mysql server ,the error will appear
[30 Jun 2016 7:04]
MySQL Verification Team
Hello! Thank you for the report. Observed this behavior in 5.7.13. Thanks, Umesh
[20 Nov 2016 21:05]
Sergio Roysen
I am going to add a comment here instead of creating a new bug report since I suspect that it is the same issue. It is a common practice to use `RENAME TABLE ... TO ...` as a way to move a table from one schema to another. If the original table that was moved is then replaced by a new table which is put in place by a new rename, it's going to result in error messages in the mysql error log implying inconsistent data in the innodb data dictionary. I tested this in the latest version: 5.7.16. Way to reproduce it: Run the following commands: ``` create database db1; create database db2; create database db3; create table db1.table_a (`id` bigint(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; create table db2.table_a (`id` bigint(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; rename table db2.table_a to db3.table_a; rename table db1.table_a to db2.table_a; ``` Now, restarting mysql, will result in the following entries in the mysql error log: ``` ... 2016-11-20T20:33:42.419122Z 0 [ERROR] InnoDB: Operating system error number 2 in a file operation. 2016-11-20T20:33:42.419168Z 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2016-11-20T20:33:42.419182Z 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2016-11-20T20:33:42.419194Z 0 [ERROR] InnoDB: Cannot open datafile for read-only: './db1/table_a.ibd' OS error: 71 2016-11-20T20:33:42.422171Z 0 [Note] InnoDB: The InnoDB data dictionary table SYS_DATAFILES for tablespace ID 25 was updated to use file ./db2/table_a.ibd. 2016-11-20T20:33:42.422295Z 0 [ERROR] InnoDB: In file './db2/table_a.ibd', tablespace id and flags are 25 and 33, but in the InnoDB data dictionary they are 26 and 33. Have you moved InnoDB .ibd files around without using the commands DISCARD TABLESPACE and IMPORT TABLESPACE? Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue. 2016-11-20T20:33:42.422313Z 0 [ERROR] InnoDB: A tablespace for `db3/table_a` has been found in multiple places; 2016-11-20T20:33:42.422319Z 0 [ERROR] InnoDB: Default location: ./db3/table_a.ibd, Space ID=26, Flags=33 2016-11-20T20:33:42.422323Z 0 [ERROR] InnoDB: Dictionary location: ./db2/table_a.ibd, Space ID=25, Flags=33 2016-11-20T20:33:42.424135Z 0 [Note] InnoDB: The InnoDB data dictionary table SYS_DATAFILES for tablespace ID 26 was updated to use file ./db3/table_a.ibd. ... ```
[23 Feb 2017 13:13]
Tobias Tobias
Unfortunately, this issue appeared on my server instance which run 5.7.13-log version. When will be solved it?
[27 Sep 2017 9:54]
Muhammad Nawaz Sohail
Faced similar issue on MySQL 5.7.16 on windows server 2012
[17 Aug 2018 0:59]
Ralph Borcherds
Still an issue with 5.7.23 running on Linux
[8 May 2019 4:17]
WANG GUANGYOU
can not repeat under 5.7.24-27-log Percona Server (GPL), Release 27,