Bug #51180 explain_filename cannot explain #sql temporary file names
Submitted: 15 Feb 2010 7:49 Modified: 28 May 2013 9:27
Reporter: Marko Mäkelä Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.41+ OS:Any
Assigned to: Mattias Jonsson CPU Architecture:Any

[15 Feb 2010 7:49] Marko Mäkelä
The function explain_filename, which was supposed to fix Bug #32430, fails to account for temporary table names that start with #sql.

An excerpt from a Bug #35077 comment demonstrates the bug:

100210 16:57:57  InnoDB: Error: table 100210 16:57:57 [Warning] Invalid (old?) table or
database name '#sql2-4947-72390'
`mydb`.<result 2 when explaining filename '#sql2-4947-72390'> does not exist in the
InnoDB internal
InnoDB: data dictionary though MySQL is trying to drop it.

How to repeat:
Kill mysqld at a suitable moment in mysql_alter_table (sql/sql_table.cc) and restart it. Or, alternatively, copy the .frm file and try DROP TABLE '#mysql50##sql…';

Suggested fix:
Make explain_filename replace the table name prefix #sql with #mysql50##sql and copy the rest of the string as UTF-8 (system_charset_info).
[28 May 2013 9:27] Mattias Jonsson
explain_filename is now only explaining partition names, and does simply return the rest as is.