2005-12-07 15:01:17 +01:00
|
|
|
drop database if exists mysqltest1;
|
2004-10-01 21:39:11 +02:00
|
|
|
create schema foo;
|
|
|
|
show create schema foo;
|
|
|
|
Database Create Database
|
2022-09-02 15:32:14 +02:00
|
|
|
foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
|
2004-10-01 21:39:11 +02:00
|
|
|
show schemas;
|
|
|
|
Database
|
|
|
|
foo
|
2013-04-07 17:17:25 +02:00
|
|
|
information_schema
|
2008-04-02 10:06:36 +02:00
|
|
|
mtr
|
2004-10-01 21:39:11 +02:00
|
|
|
mysql
|
2010-01-12 02:47:27 +01:00
|
|
|
performance_schema
|
2004-10-01 21:39:11 +02:00
|
|
|
test
|
|
|
|
drop schema foo;
|
2009-12-15 14:18:10 +01:00
|
|
|
#
|
|
|
|
# Bug #48940 MDL deadlocks against mysql_rm_db
|
|
|
|
#
|
|
|
|
DROP SCHEMA IF EXISTS schema1;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect con2, localhost, root;
|
|
|
|
connection default;
|
2009-12-15 14:18:10 +01:00
|
|
|
CREATE SCHEMA schema1;
|
|
|
|
CREATE TABLE schema1.t1 (a INT);
|
|
|
|
SET autocommit= FALSE;
|
|
|
|
INSERT INTO schema1.t1 VALUES (1);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection con2;
|
2009-12-15 14:18:10 +01:00
|
|
|
DROP SCHEMA schema1;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2010-08-10 13:16:44 +02:00
|
|
|
ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
|
|
|
|
Got one of the listed errors
|
2009-12-15 14:18:10 +01:00
|
|
|
SET autocommit= TRUE;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection con2;
|
|
|
|
connection default;
|
|
|
|
disconnect con2;
|
2010-01-12 16:15:21 +01:00
|
|
|
#
|
|
|
|
# Bug #49988 MDL deadlocks with mysql_create_db, reload_acl_and_cache
|
|
|
|
#
|
|
|
|
DROP SCHEMA IF EXISTS schema1;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect con2, localhost, root;
|
|
|
|
connection default;
|
2010-01-12 16:15:21 +01:00
|
|
|
CREATE SCHEMA schema1;
|
|
|
|
CREATE TABLE schema1.t1 (id INT);
|
|
|
|
LOCK TABLE schema1.t1 WRITE;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection con2;
|
2010-01-12 16:15:21 +01:00
|
|
|
DROP SCHEMA schema1;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2010-01-12 16:15:21 +01:00
|
|
|
# CREATE SCHEMA used to give a deadlock.
|
|
|
|
# Now we prohibit CREATE SCHEMA in LOCK TABLES mode.
|
|
|
|
CREATE SCHEMA IF NOT EXISTS schema1;
|
|
|
|
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
|
|
|
# UNLOCK TABLES so DROP SCHEMA can continue.
|
|
|
|
UNLOCK TABLES;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection con2;
|
|
|
|
connection default;
|
|
|
|
disconnect con2;
|
2010-07-01 15:53:46 +02:00
|
|
|
#
|
|
|
|
# Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER
|
|
|
|
#
|
|
|
|
CREATE DATABASE db1;
|
|
|
|
CREATE TABLE db1.t1 (a INT);
|
|
|
|
INSERT INTO db1.t1 VALUES (1), (2);
|
2016-03-25 17:51:22 +01:00
|
|
|
connect con1, localhost, root;
|
2010-07-01 15:53:46 +02:00
|
|
|
HANDLER db1.t1 OPEN;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2010-07-01 15:53:46 +02:00
|
|
|
# Sending:
|
|
|
|
DROP DATABASE db1;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect con2, localhost, root;
|
|
|
|
connection con1;
|
2010-07-01 15:53:46 +02:00
|
|
|
CREATE DATABASE db2;
|
|
|
|
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
|
|
|
|
DROP DATABASE db2;
|
2010-07-02 11:54:14 +02:00
|
|
|
HANDLER t1 CLOSE;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2010-07-01 15:53:46 +02:00
|
|
|
# Reaping: DROP DATABASE db1
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect con1;
|
|
|
|
disconnect con2;
|
2010-07-01 15:53:46 +02:00
|
|
|
#
|
|
|
|
# Tests for increased CREATE/ALTER/DROP DATABASE concurrency with
|
|
|
|
# database name locks.
|
|
|
|
#
|
|
|
|
DROP DATABASE IF EXISTS db1;
|
|
|
|
DROP DATABASE IF EXISTS db2;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect con2, localhost, root;
|
|
|
|
connect con3, localhost, root;
|
|
|
|
connection default;
|
2010-07-01 15:53:46 +02:00
|
|
|
CREATE DATABASE db1;
|
|
|
|
CREATE TABLE db1.t1 (id INT);
|
|
|
|
START TRANSACTION;
|
|
|
|
INSERT INTO db1.t1 VALUES (1);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection con2;
|
2010-07-01 15:53:46 +02:00
|
|
|
# DROP DATABASE should block due to the active transaction
|
|
|
|
# Sending:
|
|
|
|
DROP DATABASE db1;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection con3;
|
2010-07-01 15:53:46 +02:00
|
|
|
# But it should still be possible to CREATE/ALTER/DROP other databases.
|
|
|
|
CREATE DATABASE db2;
|
|
|
|
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
|
|
|
|
DROP DATABASE db2;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
2010-07-01 15:53:46 +02:00
|
|
|
# End the transaction so DROP DATABASE db1 can continue
|
|
|
|
COMMIT;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection con2;
|
2010-07-01 15:53:46 +02:00
|
|
|
# Reaping: DROP DATABASE db1
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
|
|
|
disconnect con2;
|
|
|
|
disconnect con3;
|