Bug #95346 Partitioned tables not taken into account in troubleshooting-datadict doc
Submitted: 13 May 8:27 Modified: 13 May 11:20
Reporter: Przemyslaw Malkowski Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.5-5.7 OS:Any
Assigned to: CPU Architecture:Any
Tags: data dictionary

[13 May 8:27] Przemyslaw Malkowski
Description:
When a server is forcibly killed or crashes during an ongoing DDL on a partitioned table, there will be orphaned .ibd files and tables spaces inside data dictionary, one for each partition.

The documentation about dealing with similar case - https://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html, does not take into account the partitioned case.

While the procedure to remove those orphaned table spaces is similar, it may be confusing how to proceed. For partitioned tables, the intermediate temporary files have only one .frm file and one .ibd file per each partition. So one needs to copy the .frm file with name after each .ibd file to make the DROP TABLE work. Well, and DROP TABLE here will mean really drop one partition, as there is probably not a way to remove all partitions of orphaned table with one command.

How to repeat:
Kill a server with ongoing ALTER against a partitioned table. Then, after restart, check the information_schema.INNODB_SYS_TABLES for orphaned table spaces and check the orphaned files in the datadir.

Suggested fix:
Add to the documentation how to proceed with data dictionary consistency issues for partitioned tables.
[13 May 11:20] Umesh Shastry
Hello Przemyslaw,

Thank you for the report. 

Thanks,
Umesh