2004-10-01 21:39:11 +02:00
|
|
|
#
|
|
|
|
# Just a couple of tests to make sure that schema works.
|
|
|
|
#
|
2005-12-07 15:01:17 +01:00
|
|
|
# Drop mysqltest1 database, as it can left from the previous tests.
|
|
|
|
#
|
|
|
|
|
2009-12-15 14:18:10 +01:00
|
|
|
# Save the initial number of concurrent sessions.
|
|
|
|
--source include/count_sessions.inc
|
2019-08-30 15:06:54 +02:00
|
|
|
--source include/default_charset.inc
|
2009-12-15 14:18:10 +01:00
|
|
|
|
2004-10-01 21:39:11 +02:00
|
|
|
create schema foo;
|
|
|
|
show create schema foo;
|
|
|
|
show schemas;
|
|
|
|
drop schema foo;
|
2009-12-15 14:18:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Bug #48940 MDL deadlocks against mysql_rm_db
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
connect(con2, localhost, root);
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
|
|
|
|
CREATE SCHEMA schema1;
|
|
|
|
CREATE TABLE schema1.t1 (a INT);
|
|
|
|
|
2023-10-16 17:37:16 +02:00
|
|
|
START TRANSACTION;
|
2009-12-15 14:18:10 +01:00
|
|
|
INSERT INTO schema1.t1 VALUES (1);
|
|
|
|
|
|
|
|
connection con2;
|
|
|
|
--send DROP SCHEMA schema1
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
|
Part of fix for bug#52044 "FLUSH TABLES WITH READ LOCK and
FLUSH TABLES <list> WITH READ LOCK are incompatible" to
be pushed as separate patch.
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
Also replaced "Table lock" thread state name, which was used
by threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
more consistent with other thread state names.
Updated test cases and their results according to these
changes.
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script.
mysql-test/r/query_cache.result:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/t/query_cache.test:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysys/thr_lock.c:
Replaced "Table lock" thread state name, which was used by
threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
consistent with thread state names which are used while
waiting for metadata locks and table flush.
sql/mdl.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/mdl.h:
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/sql_base.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for table flush, with a more elaborate
"Waiting for table flush".
2010-08-06 13:29:37 +02:00
|
|
|
WHERE state= 'Waiting for table metadata lock'
|
2009-12-15 14:18:10 +01:00
|
|
|
AND info='DROP SCHEMA schema1';
|
|
|
|
--source include/wait_condition.inc
|
2010-08-10 13:16:44 +02:00
|
|
|
# Error 1 is from ALTER DATABASE when the database does not exist.
|
|
|
|
# Listing the error twice to prevent result diffences based on filename.
|
|
|
|
--error 1,1
|
|
|
|
ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
|
2023-10-16 17:37:16 +02:00
|
|
|
COMMIT;
|
2009-12-15 14:18:10 +01:00
|
|
|
|
|
|
|
connection con2;
|
|
|
|
--reap
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
disconnect con2;
|
|
|
|
|
|
|
|
|
2010-01-12 16:15:21 +01:00
|
|
|
--echo #
|
|
|
|
--echo # Bug #49988 MDL deadlocks with mysql_create_db, reload_acl_and_cache
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
connect (con2, localhost, root);
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
CREATE SCHEMA schema1;
|
|
|
|
CREATE TABLE schema1.t1 (id INT);
|
|
|
|
LOCK TABLE schema1.t1 WRITE;
|
|
|
|
|
|
|
|
connection con2;
|
|
|
|
--send DROP SCHEMA schema1
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
|
Part of fix for bug#52044 "FLUSH TABLES WITH READ LOCK and
FLUSH TABLES <list> WITH READ LOCK are incompatible" to
be pushed as separate patch.
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
Also replaced "Table lock" thread state name, which was used
by threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
more consistent with other thread state names.
Updated test cases and their results according to these
changes.
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script.
mysql-test/r/query_cache.result:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/t/query_cache.test:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysys/thr_lock.c:
Replaced "Table lock" thread state name, which was used by
threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
consistent with thread state names which are used while
waiting for metadata locks and table flush.
sql/mdl.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/mdl.h:
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/sql_base.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for table flush, with a more elaborate
"Waiting for table flush".
2010-08-06 13:29:37 +02:00
|
|
|
WHERE state='Waiting for schema metadata lock' and info='DROP SCHEMA schema1';
|
2010-01-12 16:15:21 +01:00
|
|
|
--source include/wait_condition.inc
|
|
|
|
|
|
|
|
--echo # CREATE SCHEMA used to give a deadlock.
|
|
|
|
--echo # Now we prohibit CREATE SCHEMA in LOCK TABLES mode.
|
|
|
|
--error ER_LOCK_OR_ACTIVE_TRANSACTION
|
|
|
|
CREATE SCHEMA IF NOT EXISTS schema1;
|
|
|
|
|
|
|
|
--echo # UNLOCK TABLES so DROP SCHEMA can continue.
|
|
|
|
UNLOCK TABLES;
|
|
|
|
|
|
|
|
connection con2;
|
|
|
|
--reap
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
disconnect con2;
|
|
|
|
|
2010-07-01 15:53:46 +02:00
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
CREATE DATABASE db1;
|
|
|
|
CREATE TABLE db1.t1 (a INT);
|
|
|
|
INSERT INTO db1.t1 VALUES (1), (2);
|
|
|
|
|
|
|
|
connect (con1, localhost, root);
|
|
|
|
HANDLER db1.t1 OPEN;
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
--echo # Sending:
|
|
|
|
--send DROP DATABASE db1
|
|
|
|
|
|
|
|
connect (con2, localhost, root);
|
|
|
|
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
|
Part of fix for bug#52044 "FLUSH TABLES WITH READ LOCK and
FLUSH TABLES <list> WITH READ LOCK are incompatible" to
be pushed as separate patch.
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
Also replaced "Table lock" thread state name, which was used
by threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
more consistent with other thread state names.
Updated test cases and their results according to these
changes.
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script.
mysql-test/r/query_cache.result:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/t/query_cache.test:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysys/thr_lock.c:
Replaced "Table lock" thread state name, which was used by
threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
consistent with thread state names which are used while
waiting for metadata locks and table flush.
sql/mdl.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/mdl.h:
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/sql_base.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for table flush, with a more elaborate
"Waiting for table flush".
2010-08-06 13:29:37 +02:00
|
|
|
WHERE state='Waiting for table metadata lock' AND info='DROP DATABASE db1';
|
2010-07-01 15:53:46 +02:00
|
|
|
--source include/wait_condition.inc
|
|
|
|
|
|
|
|
connection con1;
|
|
|
|
# All these statements before resulted in deadlock.
|
|
|
|
CREATE DATABASE db2;
|
|
|
|
ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
|
|
|
|
DROP DATABASE db2;
|
2010-07-02 11:54:14 +02:00
|
|
|
HANDLER t1 CLOSE;
|
2010-07-01 15:53:46 +02:00
|
|
|
|
|
|
|
connection default;
|
|
|
|
--echo # Reaping: DROP DATABASE db1
|
|
|
|
--reap
|
|
|
|
disconnect con1;
|
|
|
|
disconnect con2;
|
|
|
|
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Tests for increased CREATE/ALTER/DROP DATABASE concurrency with
|
|
|
|
--echo # database name locks.
|
|
|
|
--echo #
|
|
|
|
|
|
|
|
connect (con2, localhost, root);
|
|
|
|
connect (con3, localhost, root);
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
CREATE DATABASE db1;
|
|
|
|
CREATE TABLE db1.t1 (id INT);
|
|
|
|
START TRANSACTION;
|
|
|
|
INSERT INTO db1.t1 VALUES (1);
|
|
|
|
|
|
|
|
connection con2;
|
|
|
|
--echo # DROP DATABASE should block due to the active transaction
|
|
|
|
--echo # Sending:
|
|
|
|
--send DROP DATABASE db1
|
|
|
|
|
|
|
|
connection con3;
|
|
|
|
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
|
Part of fix for bug#52044 "FLUSH TABLES WITH READ LOCK and
FLUSH TABLES <list> WITH READ LOCK are incompatible" to
be pushed as separate patch.
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
Also replaced "Table lock" thread state name, which was used
by threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
more consistent with other thread state names.
Updated test cases and their results according to these
changes.
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script.
mysql-test/r/query_cache.result:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test:
Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script. Reverted
changes to test which introduced timeout and replaced waiting
condition with a more appropriate one.
Test coverage for query_cache_wlock_invalidate behavior for
implicitly locked tables was added to query_cache.test.
mysql-test/t/query_cache.test:
Added test coverage for query_cache_wlock_invalidate
behavior for implicitly locked tables.
mysys/thr_lock.c:
Replaced "Table lock" thread state name, which was used by
threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it
consistent with thread state names which are used while
waiting for metadata locks and table flush.
sql/mdl.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush,
with a set of names which better reflect types of resources
being waited for.
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/mdl.h:
To implement this:
- Adjusted MDL_wait::timed_wait() to take thread state name
as parameter.
- Introduced method of MDL_key class which allows to get
thread state name to be used while waiting for resource
corresponding to the key and changed code to use it.
Added array translating namespaces to thread state names
as part of this change.
sql/sql_base.cc:
Replaced thread state name "Waiting for table", which was
used by threads waiting for table flush, with a more elaborate
"Waiting for table flush".
2010-08-06 13:29:37 +02:00
|
|
|
WHERE state='Waiting for table metadata lock' and info='DROP DATABASE db1';
|
2010-07-01 15:53:46 +02:00
|
|
|
--source include/wait_condition.inc
|
|
|
|
--echo # 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;
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
--echo # End the transaction so DROP DATABASE db1 can continue
|
|
|
|
COMMIT;
|
|
|
|
|
|
|
|
connection con2;
|
|
|
|
--echo # Reaping: DROP DATABASE db1
|
|
|
|
--reap
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
disconnect con2;
|
|
|
|
disconnect con3;
|
|
|
|
|
|
|
|
|
2009-12-15 14:18:10 +01:00
|
|
|
# Check that all connections opened by test cases in this file are really
|
|
|
|
# gone so execution of other tests won't be affected by their presence.
|
|
|
|
--source include/wait_until_count_sessions.inc
|