[MDEV-30233] DROP DATABASE test fails: Directory not empty Created: 2022-12-15  Updated: 2022-12-15  Resolved: 2022-12-15

Status: Closed
Project: MariaDB Server
Component/s: Tests
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.11.2, 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None


 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.


Generated at Thu Feb 08 10:14:42 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.