Bug #98083 Restarting the computer when deleting the database will cause directory residues
Submitted: 27 Dec 2019 9:02 Modified: 14 Jan 14:23
Reporter: jinming liao Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.16 OS:Any
Assigned to: CPU Architecture:Any

[27 Dec 2019 9:02] jinming liao
Description:
When deleting the database, restart the computer, then pull up the database again, and create a database with the same name, the following error will be reported:

ERROR 3678 (HY000): Schema directory './test_db' already exists. This must be resolved manually (e.g. by moving the schema directory to another location).

How to repeat:
Write a shell script, continuously create and delete a database with the same name, and restart the computer. However, this approach may not necessarily occur, the method must be:

Modify sql_db.cc:mysql_rm_db

if (! error && schema_dirp! = nullptr) {
       Rmdir_error_handler rmdir_handler;
       thd-> push_internal_handler (& rmdir_handler);
       abort (); // add abort
       (void) rm_dir_w_symlink (path, true);
       thd-> pop_internal_handler ();
}

When the database hangs, pull up the database again, create a database with the same name, and then report the following error:

ERROR 3678 (HY000): Schema directory './test_db' already exists. This must be resolved manually (e.g. by moving the schema directory to another location).
[14 Jan 14:23] Sinisa Milivojevic
Hi Mr. Liao,

Thank you for your bug report.

However, this is not a bug.

MySQL 8.0 has introduced complete mechanism for the management of the schema and tables. This system does not allow for the manual creation or deletion of tables or databases.

This is all described in our 8.0 Reference Manual.

Not a bug.