Commit c562ccf7 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-30233 DROP DATABASE test fails: Directory not empty

Some tests drop the default mtr database "test". This may fail due
to the directory not being empty. InnoDB may not delete all tables
immediately, due to the "background drop table queue" or its
replacement in commit 1bd681c8
(the purge of history would clean up after a DDL operation during
which the server was killed).

Let us try to avoid "drop database test" whenever it is easily possible.
Where it is not, SET GLOBAL innodb_max_purge_lag_wait=0 will ensure
that the replacement of the "background drop table queue" will have
completed its job.
parent 697dbd15
...@@ -4235,7 +4235,9 @@ drop table t1; ...@@ -4235,7 +4235,9 @@ drop table t1;
# #
# MDEV-24019: query with recursive CTE when no default database is set # MDEV-24019: query with recursive CTE when no default database is set
# #
drop database test; create database dummy;
use dummy;
drop database dummy;
with recursive a as with recursive a as
(select 1 from dual union select * from a as r) (select 1 from dual union select * from a as r)
select * from a; select * from a;
...@@ -4274,7 +4276,6 @@ a ...@@ -4274,7 +4276,6 @@ a
1 1
deallocate prepare stmt; deallocate prepare stmt;
drop database db1; drop database db1;
create database test;
use test; use test;
# #
# MDEV-23406: query with mutually recursive CTEs when big_tables=1 # MDEV-23406: query with mutually recursive CTEs when big_tables=1
......
...@@ -2729,7 +2729,9 @@ drop table t1; ...@@ -2729,7 +2729,9 @@ drop table t1;
--echo # MDEV-24019: query with recursive CTE when no default database is set --echo # MDEV-24019: query with recursive CTE when no default database is set
--echo # --echo #
drop database test; create database dummy;
use dummy;
drop database dummy;
let $q= let $q=
with recursive a as with recursive a as
...@@ -2757,7 +2759,6 @@ deallocate prepare stmt; ...@@ -2757,7 +2759,6 @@ deallocate prepare stmt;
drop database db1; drop database db1;
create database test;
use test; use test;
--echo # --echo #
......
...@@ -2217,8 +2217,9 @@ Warning 1931 Query execution was interrupted. The query examined at least ### ro ...@@ -2217,8 +2217,9 @@ Warning 1931 Query execution was interrupted. The query examined at least ### ro
# m_status == DA_OK_BULK' failed in Diagnostics_area::message() # m_status == DA_OK_BULK' failed in Diagnostics_area::message()
# #
call mtr.add_suppression("Sort aborted.*"); call mtr.add_suppression("Sort aborted.*");
DROP DATABASE test; create database dummy;
CREATE DATABASE test; use dummy;
drop database dummy;
USE test; USE test;
CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema; CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema;
SELECT * FROM v LIMIT ROWS EXAMINED 9; SELECT * FROM v LIMIT ROWS EXAMINED 9;
......
...@@ -1940,8 +1940,9 @@ SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10; ...@@ -1940,8 +1940,9 @@ SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;
call mtr.add_suppression("Sort aborted.*"); call mtr.add_suppression("Sort aborted.*");
DROP DATABASE test; create database dummy;
CREATE DATABASE test; use dummy;
drop database dummy;
USE test; USE test;
CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema; CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema;
......
...@@ -4469,6 +4469,7 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E ...@@ -4469,6 +4469,7 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
# MDEV-13336: add ignore-database option # MDEV-13336: add ignore-database option
# with --all-databases # with --all-databases
# #
SET GLOBAL innodb_max_purge_lag_wait=0;
DROP DATABASE test; DROP DATABASE test;
SHOW DATABASES LIKE 'test'; SHOW DATABASES LIKE 'test';
Database (test) Database (test)
......
...@@ -1921,6 +1921,8 @@ SHOW EVENTS; ...@@ -1921,6 +1921,8 @@ SHOW EVENTS;
--echo # with --all-databases --echo # with --all-databases
--echo # --echo #
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --ignore-database test --all-databases > $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql --exec $MYSQL_DUMP --default-character-set=utf8mb4 --ignore-database test --all-databases > $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql
# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
SET GLOBAL innodb_max_purge_lag_wait=0;
DROP DATABASE test; DROP DATABASE test;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql
SHOW DATABASES LIKE 'test'; SHOW DATABASES LIKE 'test';
......
...@@ -6723,7 +6723,9 @@ DROP TABLE t1; ...@@ -6723,7 +6723,9 @@ DROP TABLE t1;
# #
# MDEV-24314: create view with derived table without default database # MDEV-24314: create view with derived table without default database
# #
drop database test; create database dummy;
use dummy;
drop database dummy;
create database db1; create database db1;
create table db1.t1 (a int); create table db1.t1 (a int);
insert into db1.t1 values (3),(7),(1); insert into db1.t1 values (3),(7),(1);
...@@ -6753,7 +6755,6 @@ a ...@@ -6753,7 +6755,6 @@ a
drop view db1.v1; drop view db1.v1;
drop table db1.t1; drop table db1.t1;
drop database db1; drop database db1;
create database test;
use test; use test;
# #
# MDEV-16940: update of multi-table view returning error used in SP # MDEV-16940: update of multi-table view returning error used in SP
......
...@@ -6437,7 +6437,9 @@ DROP TABLE t1; ...@@ -6437,7 +6437,9 @@ DROP TABLE t1;
--echo # MDEV-24314: create view with derived table without default database --echo # MDEV-24314: create view with derived table without default database
--echo # --echo #
drop database test; create database dummy;
use dummy;
drop database dummy;
create database db1; create database db1;
create table db1.t1 (a int); create table db1.t1 (a int);
...@@ -6460,7 +6462,6 @@ drop view db1.v1; ...@@ -6460,7 +6462,6 @@ drop view db1.v1;
drop table db1.t1; drop table db1.t1;
drop database db1; drop database db1;
create database test;
use test; use test;
--echo # --echo #
......
SET GLOBAL innodb_max_purge_lag_wait=0;
set @save_character_set_database= @@character_set_database; set @save_character_set_database= @@character_set_database;
DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t1;
SET NAMES armscii8; SET NAMES armscii8;
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
--source include/no_valgrind_without_big.inc --source include/no_valgrind_without_big.inc
--source include/have_innodb.inc --source include/have_innodb.inc
# Starting with MariaDB 10.6, ensure that DDL recovery will have completed
# before DROP DATABASE test.
SET GLOBAL innodb_max_purge_lag_wait=0;
let $engine_type= InnoDB; let $engine_type= InnoDB;
--source suite/funcs_2/charset/charset_master.test --source suite/funcs_2/charset/charset_master.test
...@@ -299,6 +299,7 @@ select count(*) > -1 from d_trx; ...@@ -299,6 +299,7 @@ select count(*) > -1 from d_trx;
count(*) > -1 count(*) > -1
1 1
connection default; connection default;
SET GLOBAL innodb_max_purge_lag_wait=0;
drop database test; drop database test;
create database test; create database test;
drop user select_only@localhost; drop user select_only@localhost;
...@@ -306,6 +306,8 @@ select count(*) > -1 from i_trx; ...@@ -306,6 +306,8 @@ select count(*) > -1 from i_trx;
select count(*) > -1 from d_trx; select count(*) > -1 from d_trx;
connection default; connection default;
# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
SET GLOBAL innodb_max_purge_lag_wait=0;
drop database test; drop database test;
create database test; create database test;
drop user select_only@localhost; drop user select_only@localhost;
...@@ -31,6 +31,8 @@ RENAME TABLE t1 TO `t2_new..............................................end`; ...@@ -31,6 +31,8 @@ RENAME TABLE t1 TO `t2_new..............................................end`;
show warnings; show warnings;
drop table t1; drop table t1;
# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
SET GLOBAL innodb_max_purge_lag_wait=0;
drop database test; drop database test;
create database test; create database test;
use test; use test;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment