Details
Description
Some tests execute the statement
drop database test; |
to test scenarios where a default database is not available.
This may not be safe, depending on which tests have been run previously on the same server. In particular, starting with MDEV-25506 in 10.6, if InnoDB had been killed in the middle of a DDL operation, some affected files may not be removed immediately on the subsequent startup, but later when the purge of history runs. There is no wait for purge in the implementation of DROP DATABASE.
The test main.view is the most frequent example of this, but others exist too:
CURRENT_TEST: main.view
|
mysqltest: At line 6438: query 'drop database test' failed: 1010: Error dropping database (can't rmdir './test', errno: 39 "Directory not empty")
|
|
CURRENT_TEST: innodb.innodb-mdev7046
|
mysqltest: At line 34: query 'drop database test' failed: ER_DB_DROP_RMDIR (1010): Error dropping database (can't rmdir './test', errno: 39 "Directory not empty")
|
I think that we should simply avoid dropping the "test" database in tests, and use a pattern like
create database dummy; |
use dummy; |
drop database dummy; |
to achieve a similar effect.