This task is based on a patch/idea from Ali-SQL: "[Feature] Issue#34 Support force drop table" and a patch from Tencent related to the same problem.
In the end we decided to support the idea of FORCE but without the FORCE keyword:
- If a .frm table doesn't exists, try dropping the table from all storage engines.
- If the .frm table exists but the table does not exist in the engine try dropping the table from all storage engines.
- Update storage engines using many table files (.CVS, MyISAM, Aria) to succeed with the drop even if some of the files are missing.
- Add HTON_AUTOMATIC_DELETE_TABLE to handlerton's where delete_table() is not needed and always succeed. This is used by ha_delete_table_force() to know which handlers to ignore when trying to drop a table without a .frm file.
The disadvantage of this solution is that a DROP TABLE on a non existing table will be a bit slower as we have to ask all active storage engines if they know anything about the table.
Things left to do in another MDEV:
- Handle dropping of partitioned tables without .par file or .frm
- Verify that one can drop partitions with a DROP TABLE #mysql50#...