Commit a0e76bd1 authored by Dmitry Lenev's avatar Dmitry Lenev

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".
parent 176519de
......@@ -153,7 +153,7 @@ connection master;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE info = "RENAME TABLE t1 TO t3, t2 TO t1" and
state = "Waiting for table";
state = "Waiting for table metadata lock";
--source include/wait_condition.inc
COMMIT;
......
......@@ -43,7 +43,8 @@ connection default;
# of our statement.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "insert into $table (i) values (0)";
where state = "Waiting for table level lock" and
info = "insert into $table (i) values (0)";
--source include/wait_condition.inc
--disable_result_log
......
......@@ -557,7 +557,8 @@ connection waiter;
--echo connection: waiter
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t0";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t0";
--source include/wait_condition.inc
connection default;
--echo connection: default
......@@ -743,7 +744,8 @@ send alter table t1 engine=memory;
connection con2;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 engine=memory";
where state = "Waiting for table metadata lock" and
info = "alter table t1 engine=memory";
--source include/wait_condition.inc
connection default;
--error ER_ILLEGAL_HA
......@@ -764,7 +766,8 @@ send alter table t1 engine=memory;
connection con2;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 engine=memory";
where state = "Waiting for table metadata lock" and
info = "alter table t1 engine=memory";
--source include/wait_condition.inc
connection default;
--echo # Since S metadata lock was already acquired at HANDLER OPEN time
......@@ -1024,7 +1027,9 @@ connection con1;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'drop table t1' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t1';
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table metadata lock' and
info='drop table t1';
--source include/wait_condition.inc
--echo # --> connection default
connection default;
......@@ -1055,7 +1060,9 @@ connection con1;
--echo # --> connection con2
connection con2;
--echo # Waiting for 'drop table t1' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t1';
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table metadata lock' and
info='drop table t1';
--source include/wait_condition.inc
--echo # --> connection default
connection default;
......@@ -1097,7 +1104,8 @@ send rename table t0 to t3, t1 to t0, t3 to t1;
connection con1;
--echo # Waiting for 'rename table ...' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='rename table t0 to t3, t1 to t0, t3 to t1';
where state='Waiting for table metadata lock' and
info='rename table t0 to t3, t1 to t0, t3 to t1';
--source include/wait_condition.inc
--echo # --> connection default
connection default;
......@@ -1137,7 +1145,9 @@ connection con2;
--echo # --> connection con1
connection con1;
--echo # Waiting for 'drop table t2' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t2';
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table metadata lock' and
info='drop table t2';
--source include/wait_condition.inc
--echo # --> connection default
connection default;
......@@ -1146,7 +1156,9 @@ send select * from t2;
--echo # --> connection con1
connection con1;
--echo # Waiting for 'select * from t2' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='select * from t2';
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table metadata lock' and
info='select * from t2';
unlock tables;
--echo # --> connection con2
connection con2;
......@@ -1190,10 +1202,14 @@ connection default;
--echo # --> connection con3
connection con3;
--echo # Waiting for 'drop table t1' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t1';
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table metadata lock' and
info='drop table t1';
--source include/wait_condition.inc
--echo # Waiting for 'drop table t2' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t2';
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table metadata lock' and
info='drop table t2';
--source include/wait_condition.inc
--echo # Demonstrate that t2 lock was released and t2 was dropped
--echo # after ROLLBACK TO SAVEPOINT
......@@ -1255,10 +1271,14 @@ connection default;
--echo # --> connection con3
connection con3;
--echo # Waiting for 'drop table t1' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t1';
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table metadata lock' and
info='drop table t1';
--source include/wait_condition.inc
--echo # Waiting for 'drop table t2' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t2';
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table metadata lock' and
info='drop table t2';
--source include/wait_condition.inc
--echo # Demonstrate that t2 lock was released and t2 was dropped
--echo # after ROLLBACK TO SAVEPOINT
......@@ -1314,7 +1334,9 @@ drop table t1, t2;
--echo # --> connection con2
connection con2;
--echo # Waiting for 'drop table t3' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t3';
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table metadata lock' and
info='drop table t3';
--source include/wait_condition.inc
--echo # Demonstrate that ROLLBACK TO SAVEPOINT didn't release the handler
--echo # lock.
......@@ -1348,7 +1370,9 @@ send drop table t2;
--echo # --> connection con2
connection con2;
--echo # Waiting for 'drop table t2' to get blocked...
let $wait_condition=select count(*)=1 from information_schema.processlist where state='Waiting for table' and info='drop table t2';
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table metadata lock' and
info='drop table t2';
--source include/wait_condition.inc
--echo # --> connection con1
connection con1;
......@@ -1400,7 +1424,8 @@ connection con2;
--echo # has read from the table commits.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock tables t1 write";
where state = "Waiting for table metadata lock" and
info = "lock tables t1 write";
--source include/wait_condition.inc
--echo # --> connection default
......@@ -1427,7 +1452,8 @@ connection con1;
--echo # Waiting for 'handler t1 read a next' to get blocked...
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "handler t1 read a next";
where state = "Waiting for table level lock" and
info = "handler t1 read a next";
--source include/wait_condition.inc
--echo # The below 'drop table t1' should be able to proceed without
......
......@@ -1583,7 +1583,7 @@ connect (con1, localhost, root,,);
--echo # Connection default
connection default;
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' AND info='TRUNCATE TABLE t1';
WHERE state='Waiting for table metadata lock' AND info='TRUNCATE TABLE t1';
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY a;
ROLLBACK;
......
......@@ -701,6 +701,7 @@ drop table t1,t2,t3,t4;
set query_cache_wlock_invalidate=1;
create table t1 (a int not null);
create table t2 (a int not null);
create view v1 as select * from t1;
select * from t1;
a
select * from t2;
......@@ -713,6 +714,17 @@ show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
unlock table;
select * from t1;
a
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
lock table v1 write;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
unlock table;
drop view v1;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
CREATE TABLE t1 (id INT PRIMARY KEY);
......@@ -853,7 +865,7 @@ Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 18
Qcache_inserts 19
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 6
......@@ -866,7 +878,7 @@ Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 19
Qcache_inserts 20
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 7
......
......@@ -148,12 +148,12 @@ f1()
# Sending 'drop procedure p1'...
drop procedure p1;
# --> connection con2
# Waitng for 'drop procedure t1' to get blocked on MDL lock...
# Waiting for 'drop procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
# Waitng for 'select f1()' to get blocked by a pending MDL lock...
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
......@@ -174,12 +174,12 @@ f1()
# Sending 'create procedure p1'...
create procedure p1() begin end;
# --> connection con2
# Waitng for 'create procedure t1' to get blocked on MDL lock...
# Waiting for 'create procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
# Waitng for 'select f1()' to get blocked by a pending MDL lock...
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
......@@ -200,12 +200,12 @@ f1()
# Sending 'alter procedure p1'...
alter procedure p1 contains sql;
# --> connection con2
# Waitng for 'alter procedure t1' to get blocked on MDL lock...
# Waiting for 'alter procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
# Waitng for 'select f1()' to get blocked by a pending MDL lock...
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
......@@ -226,12 +226,12 @@ f1()
# Sending 'drop function f1'...
drop function f1;
# --> connection con2
# Waitng for 'drop function f1' to get blocked on MDL lock...
# Waiting for 'drop function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
# Waitng for 'select f1()' to get blocked by a pending MDL lock...
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
......@@ -252,12 +252,12 @@ f1()
# Sending 'create function f1'...
create function f1() returns int return 2;
# --> connection con2
# Waitng for 'create function f1' to get blocked on MDL lock...
# Waiting for 'create function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
# Waitng for 'select f1()' to get blocked by a pending MDL lock...
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
......@@ -279,12 +279,12 @@ f1()
# Sending 'alter function f1'...
alter function f1 contains sql;
# --> connection con2
# Waitng for 'alter function f1' to get blocked on MDL lock...
# Waiting for 'alter function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
# Waitng for 'select f1()' to get blocked by a pending MDL lock...
# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
......@@ -360,7 +360,7 @@ insert into t1 (a) values (1);
# Sending 'drop function f1'
drop function f1;
# --> connection con2
# Waitng for 'drop function f1' to get blocked on MDL lock...
# Waiting for 'drop function f1' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
......@@ -379,7 +379,7 @@ a
# Sending 'drop function f1'
drop function f1;
# --> connection con2
# Waitng for 'drop function f1' to get blocked on MDL lock...
# Waiting for 'drop function f1' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
......@@ -403,7 +403,7 @@ a
# Sending 'drop procedure p1'
drop procedure p1;
# --> connection con2
# Waitng for 'drop procedure p1' to get blocked on MDL lock...
# Waiting for 'drop procedure p1' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
......@@ -424,7 +424,7 @@ insert into t1 (a) values (3);
# Sending 'drop function f2'
drop function f2;
# --> connection con2
# Waitng for 'drop function f2' to get blocked on MDL lock...
# Waiting for 'drop function f2' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
......@@ -479,11 +479,11 @@ f2()
# Sending 'drop function f1'...
drop function f1;
# --> connection con2
# Waitng for 'drop function f1' to get blocked on MDL lock...
# Waiting for 'drop function f1' to get blocked on MDL lock...
# Sending 'drop function f2'...
drop function f2;
# --> connection default
# Waitng for 'drop function f2' to get blocked on MDL lock...
# Waiting for 'drop function f2' to get blocked on MDL lock...
rollback to savepoint sv;
# --> connection con2
# Reaping 'drop function f2'...
......@@ -537,10 +537,10 @@ f1()
# Sending 'alter function f1 ...'...
alter function f1 comment "comment";
# --> connection con2
# Waitng for 'alter function f1 ...' to get blocked on MDL lock...
# Waiting for 'alter function f1 ...' to get blocked on MDL lock...
# Sending 'call p1()'...
call p1();
# Waitng for 'call p1()' to get blocked on MDL lock on f1...
# Waiting for 'call p1()' to get blocked on MDL lock on f1...
# Let 'alter function f1 ...' go through...
commit;
# --> connection con1
......@@ -573,7 +573,7 @@ f1()
# Sending 'alter function f1 ...'...
alter function f1 comment "comment";
# --> connection con2
# Waitng for 'alter function f1 ...' to get blocked on MDL lock...
# Waiting for 'alter function f1 ...' to get blocked on MDL lock...
#
# We just mention p1() in the body of f2() to make
# sure that p1() is prelocked for f2().
......@@ -595,7 +595,7 @@ select f2() into @var;
end|
# Sending 'call p1()'...
call p1();
# Waitng for 'call p1()' to get blocked on MDL lock on f1...
# Waiting for 'call p1()' to get blocked on MDL lock on f1...
# Let 'alter function f1 ...' go through...
commit;
# --> connection con1
......@@ -634,7 +634,7 @@ get_lock("30977", 0)
# Sending 'select f3()'...
select f3();
# --> connection con1
# Waitng for 'select f3()' to get blocked on the user level lock...
# Waiting for 'select f3()' to get blocked on the user level lock...
# Do something to change the cache version.
create function f4() returns int return 4;
drop function f4;
......
......@@ -35,7 +35,7 @@ call bug9486();
show processlist;
Id User Host db Command Time State Info
# root localhost test Sleep # NULL
# root localhost test Query # Waiting for table update t1, t2 set val= 1 where id1=id2
# root localhost test Query # Waiting for table metadata lock update t1, t2 set val= 1 where id1=id2
# root localhost test Query # NULL show processlist
# root localhost test Sleep # NULL
unlock tables;
......
......@@ -60,7 +60,7 @@ let $wait_condition=
--echo # con1
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE
state = "Table lock" and info = "INSERT INTO t2 VALUES (3)";
state = "Waiting for table level lock" and info = "INSERT INTO t2 VALUES (3)";
--source include/wait_condition.inc
SELECT RELEASE_LOCK('Bug#34306');
--connection con2
......
......@@ -367,14 +367,14 @@ echo
;
connection default;
echo
# Poll till INFO is no more NULL and State = 'Waiting for table'.
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
;
let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO IS NOT NULL AND STATE = 'Waiting for table';
WHERE INFO IS NOT NULL AND STATE = 'Waiting for table metadata lock';
--source include/wait_condition.inc
#
# Expect to see the state 'Waiting for table' for the third connection because the SELECT
# collides with the WRITE TABLE LOCK.
# Expect to see the state 'Waiting for table metadata lock' for the third
# connection because the SELECT collides with the WRITE TABLE LOCK.
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
UNLOCK TABLES;
......@@ -422,10 +422,10 @@ echo
;
connection default;
echo
# Poll till INFO is no more NULL and State = 'Waiting for table'.
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
;
let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO IS NOT NULL AND STATE = 'Waiting for table';
WHERE INFO IS NOT NULL AND STATE = 'Waiting for table metadata lock';
--source include/wait_condition.inc
echo
# Expect result:
......
......@@ -193,11 +193,11 @@ LOCK TABLE test.t1 WRITE;
SELECT COUNT(*) FROM test.t1;
# ----- switch to connection default (user = root) -----
# Poll till INFO is no more NULL and State = 'Waiting for table'.
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO
<ID> test_user <HOST_NAME> information_schema Query <TIME> Waiting for table SELECT COUNT(*) FROM test.t1
<ID> test_user <HOST_NAME> information_schema Query <TIME> Waiting for table metadata lock SELECT COUNT(*) FROM test.t1
<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL
<ID> root <HOST_NAME> information_schema Query <TIME> executing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
UNLOCK TABLES;
......@@ -221,7 +221,7 @@ LOCK TABLE test.t1 WRITE;
SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END' AS "Long string" FROM test.t1;
# ----- switch to connection default (user = root) -----
# Poll till INFO is no more NULL and State = 'Waiting for table'.
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
# Expect result:
# Statement Content of INFO
......
......@@ -193,11 +193,11 @@ LOCK TABLE test.t1 WRITE;
SELECT COUNT(*) FROM test.t1;
# ----- switch to connection default (user = root) -----
# Poll till INFO is no more NULL and State = 'Waiting for table'.
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO
<ID> test_user <HOST_NAME> information_schema Query <TIME> Waiting for table SELECT COUNT(*) FROM test.t1
<ID> test_user <HOST_NAME> information_schema Query <TIME> Waiting for table metadata lock SELECT COUNT(*) FROM test.t1
<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL
<ID> root <HOST_NAME> information_schema Execute <TIME> executing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
UNLOCK TABLES;
......@@ -221,7 +221,7 @@ LOCK TABLE test.t1 WRITE;
SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END' AS "Long string" FROM test.t1;
# ----- switch to connection default (user = root) -----
# Poll till INFO is no more NULL and State = 'Waiting for table'.
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
# Expect result:
# Statement Content of INFO
......
......@@ -87,7 +87,8 @@ connection con1;
--echo # Wait until LOCK TABLE is blocked on SQL-level lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # We should be able to do UPDATEs and SELECTs within transaction.
update t1 set x=1 where id = 0;
......
......@@ -30,7 +30,7 @@ connection master1;
connection master;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table" AND info = "DROP TABLE tt";
WHERE state = "Waiting for table metadata lock" AND info = "DROP TABLE tt";
--source include/wait_condition.inc
ROLLBACK TO SAVEPOINT insert_statement;
COMMIT;
......
......@@ -655,7 +655,8 @@ connection master;
connection master1;
--echo # Waitng for 'insert into t1 ...' to get blocked on table lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='insert into t1 (a) values (f1())';
where state='Waiting for table metadata lock' and
info='insert into t1 (a) values (f1())';
--source include/wait_condition.inc
--echo # Sending 'drop function f1'. It will wait till insert finishes.
--send drop function f1;
......@@ -663,7 +664,7 @@ where state='Waiting for table' and info='insert into t1 (a) values (f1())';
connection default;
--echo # Check that 'drop function f1' gets blocked.
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='drop function f1';
where state='Waiting for stored function metadata lock' and info='drop function f1';
--source include/wait_condition.inc
--echo # Now let's let 'insert' go through...
unlock tables;
......
......@@ -56,7 +56,7 @@ let $wait_condition=
connection master;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "drop view v1";
where state = "Waiting for table metadata lock" and info = "drop view v1";
--source include/wait_condition.inc
select release_lock("lock_bg25144");
......@@ -106,7 +106,7 @@ let $wait_condition=
connection master;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info = "alter view v1 as select * from t2";
--source include/wait_condition.inc
......
......@@ -37,9 +37,9 @@ INSERT INTO t1(name) VALUES('Record_7');
connection default;
## show processlist info and state ##
SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE state= "Table lock" AND info LIKE "INSERT INTO t1%";
WHERE state= "Waiting for table level lock" AND info LIKE "INSERT INTO t1%";
state info
Table lock INSERT INTO t1(name) VALUES('Record_7')
Waiting for table level lock INSERT INTO t1(name) VALUES('Record_7')
## table contents befor UNLOCK ##
SELECT * FROM t1;
name
......
......@@ -11,7 +11,6 @@ CREATE TABLE t1(id int, value varchar(10));
INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2');
INSERT INTO t1 VALUES(3, 'val3');
CREATE VIEW v1 AS SELECT * FROM t1;
SET GLOBAL query_cache_size = 131072;
FLUSHING CACHE
SET GLOBAL query_cache_size = 0;
......@@ -33,11 +32,11 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 1
1 Expected
LOCK TABLE v1 WRITE;
LOCK TABLE t1 WRITE;
UNLOCK TABLES;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 1
Qcache_queries_in_cache 0
0 Expected
'#----------------------------FN_DYNVARS_136_02-----------------------#'
SELECT * FROM t1;
......@@ -49,13 +48,12 @@ id value
2 val2
3 val3
** Connection con0 **
LOCK TABLE v1 WRITE;
LOCK TABLE t1 WRITE;
** Connection con1 **
** Asynchronous Execution **
SELECT * FROM t1;
** Connection con0 **
wait until table is locked
Timeout in wait_condition.inc for SELECT count(*) > 0 FROM information_schema.processlist WHERE state= 'Table lock'
UNLOCK TABLES;
** Connection con1 **
** Asynchronous Result **
......@@ -79,7 +77,7 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 1
1 Expected
LOCK TABLE v1 WRITE;
LOCK TABLE t1 WRITE;
UNLOCK TABLES;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
......@@ -102,7 +100,7 @@ id value
2 val2
3 val3
** Connection con0 **
LOCK TABLE v1 WRITE;
LOCK TABLE t1 WRITE;
** Connection con1 **
** Should not be blocked **
SELECT * FROM t1;
......@@ -165,4 +163,3 @@ SET @@GLOBAL.query_cache_type = @old_cache_type;
** Connection default **
Disconnecting Connections con0, con1
DROP TABLE t1;
DROP VIEW v1;
......@@ -98,12 +98,13 @@ INSERT INTO t1(name) VALUES('Record_7');
connection default;
# wait until INSERT will be locked (low performance)
let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE state= "Table lock" AND info LIKE "INSERT INTO t1%";
WHERE state= "Waiting for table level lock" AND
info LIKE "INSERT INTO t1%";
--source include/wait_condition.inc
--echo ## show processlist info and state ##
SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE state= "Table lock" AND info LIKE "INSERT INTO t1%";
WHERE state= "Waiting for table level lock" AND info LIKE "INSERT INTO t1%";
--echo ## table contents befor UNLOCK ##
SELECT * FROM t1;
UNLOCK TABLES;
......
......@@ -123,7 +123,7 @@ connection default;
--echo ** Wait till con0 is blocked **
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = 'Table lock' AND info = '$my_select';
WHERE state = 'Waiting for table level lock' AND info = '$my_select';
--source include/wait_condition.inc
UNLOCK TABLES;
......@@ -219,7 +219,7 @@ connection default;
--echo ** Wait till con0 is blocked **
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = 'Table lock' AND info = '$my_select';
WHERE state = 'Waiting for table level lock' AND info = '$my_select';
--source include/wait_condition.inc
UNLOCK TABLES;
......
......@@ -60,8 +60,6 @@ INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2');
INSERT INTO t1 VALUES(3, 'val3');
CREATE VIEW v1 AS SELECT * FROM t1;
#
# Clearing the query cache and setting up cache size
#
......@@ -101,7 +99,7 @@ SELECT * FROM t1;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 1 Expected
LOCK TABLE v1 WRITE;
LOCK TABLE t1 WRITE;
UNLOCK TABLES;
......@@ -129,7 +127,7 @@ SELECT * FROM t1;
--echo ** Connection con0 **
connection con0;
LOCK TABLE v1 WRITE;
LOCK TABLE t1 WRITE;
--echo ** Connection con1 **
connection con1;
......@@ -141,7 +139,8 @@ send SELECT * FROM t1;
connection con0;
--echo wait until table is locked
let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state= 'Table lock';
let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist
WHERE state= 'Waiting for table metadata lock';
--source include/wait_condition.inc
UNLOCK TABLES;
......@@ -177,7 +176,7 @@ SELECT * FROM t1;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 1 Expected
LOCK TABLE v1 WRITE;
LOCK TABLE t1 WRITE;
UNLOCK TABLES;
......@@ -201,7 +200,7 @@ SELECT * FROM t1;
--echo ** Connection con0 **
connection con0;
LOCK TABLE v1 WRITE;
LOCK TABLE t1 WRITE;
--echo ** Connection con1 **
connection con1;
......@@ -283,7 +282,6 @@ disconnect con0;
disconnect con1;
DROP TABLE t1;
DROP VIEW v1;
--enable_ps_protocol
......@@ -86,7 +86,9 @@ delimiter ;|
--echo ** Connection con0 **
connection con0;
let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state='Table lock' AND info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")';
let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist
WHERE state='Waiting for table level lock' AND
info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")';
--source include/wait_condition.inc
--echo ** Asynchronous Execution **
......@@ -102,7 +104,8 @@ delimiter ;|
--echo ** Connection default **
connection default;
let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist WHERE state LIKE 'Table lock';
let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist
WHERE state LIKE 'Waiting for table level lock';
--source include/wait_condition.inc
UNLOCK TABLES;
......@@ -157,7 +160,9 @@ delimiter ;|
--echo ** Connection con0 **
connection con0;
let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state='Table lock' AND info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")';
let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist
WHERE state='Waiting for table level lock' AND
info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")';
--source include/wait_condition.inc
--echo ** Asynchronous Execution **
......@@ -173,7 +178,8 @@ delimiter ;|
--echo ** Connection default **
connection default;
let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist WHERE state LIKE 'Table lock';
let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist
WHERE state LIKE 'Waiting for table level lock';
--source include/wait_condition.inc
UNLOCK TABLES;
......
......@@ -307,7 +307,7 @@ connection update;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where command = "Delayed insert" and state = "Table lock";
where command = "Delayed insert" and state = "Waiting for table level lock";
--source include/wait_condition.inc
connect (select,localhost,root,,);
--echo connection: select
......
......@@ -1470,7 +1470,8 @@ connection con3726_2;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info like "rename table t2 to t3";
where state = "Waiting for table metadata lock" and
info like "rename table t2 to t3";
--source include/wait_condition.inc
--echo # These statements should not be blocked by pending lock requests
select table_name, column_name, data_type from information_schema.columns
......
......@@ -42,7 +42,7 @@ let $wait_condition=
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE info = "DROP TABLE t1" and
state = "Waiting for table";
state = "Waiting for table metadata lock";
--source include/wait_condition.inc
--echo # Connection 1 is now holding the lock.
--echo # Issuing insert from connection 1 while connection 2&3
......@@ -97,7 +97,8 @@ connection default;
--echo # connection holds SW metadata lock on table to be altered.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column c4 int";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column c4 int";
--source include/wait_condition.inc
--echo # The below statement should succeed. It should not
......@@ -196,7 +197,7 @@ connection default;
--echo # Connection con1
connection con1;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' AND info='OPTIMIZE TABLE t1';
WHERE state='Waiting for table metadata lock' AND info='OPTIMIZE TABLE t1';
--source include/wait_condition.inc
SELECT * FROM t1;
COMMIT;
......@@ -241,7 +242,7 @@ connection con2;
--echo # Waiting for 'SELECT * FROM v1' to sync in.
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table" AND info = "SELECT * FROM v1";
WHERE state = "Waiting for table metadata lock" AND info = "SELECT * FROM v1";
--source include/wait_condition.inc
# This should block due to v1 being locked.
--echo # Sending:
......@@ -252,7 +253,8 @@ connection con3;
--echo # Waiting for 'ALTER VIEW v1 AS SELECT 2 FROM t2' to sync in.
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table" AND info = "ALTER VIEW v1 AS SELECT 2 FROM t2";
WHERE state = "Waiting for table metadata lock" AND
info = "ALTER VIEW v1 AS SELECT 2 FROM t2";
--source include/wait_condition.inc
# Unlock t1 allowing SELECT * FROM v1 to proceed.
UNLOCK TABLES;
......
......@@ -799,8 +799,9 @@ connection default;
--echo # table as it acquires LOCK_S locks on rows of old version, which
--echo # are compatible with locks acquired by connection 'con1'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist where state =
"Waiting for table" and info = "alter table t1 add column j int";
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column j int";
--source include/wait_condition.inc
--echo # The below statement will deadlock because it will try to acquire
......@@ -844,7 +845,8 @@ connection default;
--echo # Wait until ALTER is blocked because of active SR lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 rebuild partition p0";
where state = "Waiting for table metadata lock" and
info = "alter table t1 rebuild partition p0";
--source include/wait_condition.inc
--echo # The below statement should succeed as transaction
......
......@@ -174,7 +174,7 @@ connection default;
# we must wait till the insert opens and locks the table
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and id = $ID;
where state = "Waiting for table level lock" and id = $ID;
--source include/wait_condition.inc
connect (select,localhost,root,,);
--echo connection: select
......
......@@ -357,7 +357,8 @@ let $ID= `select connection_id()`;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--replace_result $ID ID
eval kill query $ID;
......@@ -372,7 +373,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info = "drop table t1";
--source include/wait_condition.inc
--replace_result $ID ID
......@@ -388,7 +389,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info = "create trigger t1_bi before insert on t1 for each row set @a:=1";
--source include/wait_condition.inc
--replace_result $ID ID
......@@ -407,7 +408,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column j int";
--source include/wait_condition.inc
--replace_result $ID ID
......@@ -423,7 +424,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info = "alter table t1 rename to t2";
--source include/wait_condition.inc
--replace_result $ID ID
......@@ -437,7 +438,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info = "alter table t1 disable keys";
--source include/wait_condition.inc
--replace_result $ID ID
......@@ -452,7 +453,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info = "alter table t1 alter column i set default 100";
--source include/wait_condition.inc
--replace_result $ID ID
......@@ -474,7 +475,7 @@ connection ddl;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info = "alter table t2 alter column i set default 100";
--source include/wait_condition.inc
--replace_result $ID ID
......@@ -499,7 +500,7 @@ connection ddl;
connection dml;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info = "rename tables t1 to t3, t2 to t1";
--source include/wait_condition.inc
let $ID2= `select connection_id()`;
......@@ -508,7 +509,7 @@ let $ID2= `select connection_id()`;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info = "insert into t2 values (1)";
--source include/wait_condition.inc
--replace_result $ID2 ID2
......@@ -544,7 +545,7 @@ let $wait_condition=
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table flush" and
info = "select * from t1";
--source include/wait_condition.inc
--replace_result $ID2 ID2
......
......@@ -32,7 +32,8 @@ connection reader;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "update low_priority t1 set n = 4";
where state = "Waiting for table level lock" and
info = "update low_priority t1 set n = 4";
--source include/wait_condition.inc
send
select n from t1;
......@@ -40,7 +41,8 @@ connection locker2;
# Sleep a bit till the select of connection reader is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "select n from t1";
where state = "Waiting for table level lock" and
info = "select n from t1";
--source include/wait_condition.inc
select release_lock("mysqltest_lock");
connection locker;
......@@ -72,7 +74,8 @@ connection reader;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "update low_priority t1 set n = 4";
where state = "Waiting for table level lock" and
info = "update low_priority t1 set n = 4";
--source include/wait_condition.inc
select n from t1;
connection locker2;
......@@ -120,7 +123,8 @@ insert t1 select * from t2;
connection locker;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "insert t1 select * from t2";
where state = "Waiting for table metadata lock" and
info = "insert t1 select * from t2";
--source include/wait_condition.inc
drop table t2;
unlock tables;
......@@ -145,7 +149,8 @@ connection locker;
# Sleep a bit till the insert of connection reader is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "insert t1 select * from t2";
where state = "Waiting for table metadata lock" and
info = "insert t1 select * from t2";
--source include/wait_condition.inc
drop table t2;
unlock tables;
......@@ -191,7 +196,7 @@ connection locker;
# Sleep a bit till the select of connection reader is in work and hangs
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table" AND info =
WHERE state = "Waiting for table metadata lock" AND info =
"SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1";
--source include/wait_condition.inc
# Make test case independent from earlier grants.
......@@ -223,7 +228,8 @@ connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "FLUSH TABLES WITH READ LOCK";
where state = "Waiting for global metadata lock" and
info = "FLUSH TABLES WITH READ LOCK";
--source include/wait_condition.inc
# This must not block.
--error ER_TABLE_NOT_LOCKED
......@@ -254,7 +260,8 @@ connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "FLUSH TABLES WITH READ LOCK";
where state = "Waiting for global metadata lock" and
info = "FLUSH TABLES WITH READ LOCK";
--source include/wait_condition.inc
--error ER_TABLE_NOT_LOCKED
CREATE TABLE t2 AS SELECT * FROM t1;
......@@ -326,7 +333,8 @@ connection reader;
# Wait till connection writer is blocked
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 auto_increment=0";
where state = "Waiting for table metadata lock" and
info = "alter table t1 auto_increment=0";
--source include/wait_condition.inc
send
alter table t1 auto_increment=0;
......@@ -334,7 +342,8 @@ connection locker;
# Wait till connection reader is blocked
let $wait_condition=
select count(*) = 2 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 auto_increment=0";
where state = "Waiting for table metadata lock" and
info = "alter table t1 auto_increment=0";
--source include/wait_condition.inc
unlock tables;
connection writer;
......@@ -367,7 +376,8 @@ connection con5;
--echo # con5
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "flush tables with read lock";
where state = "Waiting for global metadata lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
--echo # global read lock is taken
connection con3;
......@@ -489,16 +499,20 @@ update t1 set i= 10;
connection reader;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "update t1 set i= 10";
where state = "Waiting for table level lock" and
info = "update t1 set i= 10";
--source include/wait_condition.inc
send
select * from t1;
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "select * from t1";
where state = "Waiting for table level lock" and
info = "select * from t1";
--source include/wait_condition.inc
let $ID= `select id from information_schema.processlist where state = "Table lock" and info = "update t1 set i= 10"`;
let $ID= `select id from information_schema.processlist
where state = "Waiting for table level lock" and
info = "update t1 set i= 10"`;
--replace_result $ID ID
eval kill query $ID;
connection reader;
......@@ -557,7 +571,7 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table";
where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
alter table t1 add column j int;
connect (insert,localhost,root,,test,,);
......@@ -565,7 +579,7 @@ connection insert;
--echo connection: insert
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table";
where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
--send insert into t1 values (1,2);
--echo connection: default
......@@ -615,12 +629,12 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table";
where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
flush tables;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table";
where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
unlock tables;
connection flush;
......@@ -646,7 +660,8 @@ send insert into t1 values(1);
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "insert into t1 values(1)";
where state = "Waiting for table level lock" and
info = "insert into t1 values(1)";
--source include/wait_condition.inc
let $tlwb= `show status like 'Table_locks_waited'`;
unlock tables;
......@@ -683,12 +698,12 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table";
where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
flush tables;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table";
where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
drop table t1;
connection flush;
......@@ -725,7 +740,8 @@ connection default;
--echo # connection holds SW metadata lock on table to be altered.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column c4 int";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column c4 int";
--source include/wait_condition.inc
--echo # The below statement should succeed. It should not
......@@ -825,7 +841,8 @@ connection default;
--echo # Wait until ALTER TABLE gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column j int";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column j int";
--source include/wait_condition.inc
--echo # The below statement should try to acquire SW lock on 't1'
--echo # and therefore should get ER_LOCK_DEADLOCK error. Before
......@@ -855,7 +872,8 @@ connection default;
--echo # Wait until ALTER TABLE gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 drop column j";
where state = "Waiting for table metadata lock" and
info = "alter table t1 drop column j";
--source include/wait_condition.inc
--echo # The below statement should try to acquire SW lock on 't1'
--echo # and therefore should get ER_LOCK_DEADLOCK error. Before
......@@ -1014,7 +1032,8 @@ connection con3;
connection con2;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table" AND info = "DROP TABLE t1, t2";
WHERE state = "Waiting for table metadata lock" AND
info = "DROP TABLE t1, t2";
--source include/wait_condition.inc
# Note: This query causes two timeouts.
# 1: try_acquire_high_prio_shared_mdl_lock on t1
......@@ -1069,7 +1088,8 @@ connection default;
--echo # Wait until RENAME TABLE is blocked on table 't3'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename tables t1 to t2, t2 to t3";
where state = "Waiting for table metadata lock" and
info = "rename tables t1 to t2, t2 to t3";
--source include/wait_condition.inc
--echo # Kill RENAME TABLE.
--replace_result $ID ID
......
......@@ -898,7 +898,7 @@ set debug_sync= 'now WAIT_FOR parked';
connection default;
--echo # Wait until this LOCK TABLES statement starts waiting for table lock.
let $wait_condition= select count(*)= 1 from information_schema.processlist
where state= 'Table lock' and
where state= 'Waiting for table level lock' and
info='lock table v1 write';
--source include/wait_condition.inc
--echo # Allow SELECT ... FOR UPDATE to resume.
......@@ -972,7 +972,7 @@ connection default;
connection con2;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Waiting for table"
WHERE state = "Waiting for table metadata lock"
AND info = "ALTER TABLE t1 ADD COLUMN j INT";
--source include/wait_condition.inc
......
......@@ -128,7 +128,8 @@ connection mdl_con2;
--echo # Check that the above RENAME is blocked because of S lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
......@@ -158,7 +159,8 @@ connection mdl_con2;
--echo # Check that the above ALTER TABLE is blocked because of S lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column c2 int";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
......@@ -190,7 +192,8 @@ connection mdl_con2;
--echo # because of S lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column c2 int";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
......@@ -245,7 +248,8 @@ connection mdl_con2;
--echo # Check that the above RENAME is blocked because of SH lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
......@@ -280,7 +284,8 @@ connection mdl_con2;
--echo # Check that the above ALTER TABLE is blocked because of SH lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column c2 int";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
......@@ -316,7 +321,8 @@ connection mdl_con2;
--echo # because of S lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column c2 int";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
......@@ -367,7 +373,8 @@ connection default;
--echo # Check that the above LOCK TABLES is blocked because of SR lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Unblock LOCK TABLES.
commit;
......@@ -395,7 +402,8 @@ connection mdl_con2;
--echo # Check that the above RENAME is blocked because of SR lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
......@@ -426,7 +434,8 @@ connection mdl_con2;
--echo # Check that the above ALTER TABLE is blocked because of SR lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column c2 int";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
......@@ -479,7 +488,8 @@ connection default;
--echo # Check that the above ALTER TABLE is blocked because of SW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE.
commit;
......@@ -506,7 +516,8 @@ connection default;
--echo # Check that the above LOCK TABLES is blocked because of SW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Unblock LOCK TABLES.
commit;
......@@ -534,7 +545,8 @@ connection mdl_con2;
--echo # Check that the above RENAME is blocked because of SW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
......@@ -583,7 +595,8 @@ connection mdl_con2;
--echo # Check that the above DELETE is blocked because of SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "delete from t1 limit 2";
where state = "Waiting for table metadata lock" and
info = "delete from t1 limit 2";
--source include/wait_condition.inc
--echo # Unblock ALTER and thus DELETE.
set debug_sync= 'now SIGNAL finish';
......@@ -617,7 +630,8 @@ connection mdl_con2;
--echo # Check that the above ALTER is blocked because of SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Unblock ALTERs.
set debug_sync= 'now SIGNAL finish';
......@@ -652,7 +666,8 @@ connection mdl_con2;
--echo # Check that the above LOCK TABLES is blocked because of SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Unblock ALTER and thus LOCK TABLES.
set debug_sync= 'now SIGNAL finish';
......@@ -688,7 +703,8 @@ connection mdl_con2;
--echo # Check that the above RENAME is blocked because of SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Unblock ALTER and thus RENAME TABLE.
set debug_sync= 'now SIGNAL finish';
......@@ -735,7 +751,8 @@ connection default;
--echo # Check that the above SELECT is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "select count(*) from t1";
where state = "Waiting for table metadata lock" and
info = "select count(*) from t1";
--source include/wait_condition.inc
--echo # Unblock SELECT.
unlock tables;
......@@ -760,7 +777,8 @@ connection default;
--echo # Check that the above DELETE is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "delete from t1 limit 1";
where state = "Waiting for table metadata lock" and
info = "delete from t1 limit 1";
--source include/wait_condition.inc
--echo # Unblock DELETE.
unlock tables;
......@@ -785,7 +803,8 @@ connection default;
--echo # Check that the above ALTER is blocked because of UNWR lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Unblock ALTER.
unlock tables;
......@@ -811,7 +830,8 @@ connection default;
--echo # Check that the above LOCK TABLES is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Unblock waiting LOCK TABLES.
unlock tables;
......@@ -838,7 +858,8 @@ connection default;
--echo # Check that the above RENAME is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
......@@ -879,7 +900,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that S lock in incompatible with X lock.
--echo # Sending:
......@@ -890,7 +912,8 @@ connection mdl_con2;
--echo # Check that the above HANDLER statement is blocked because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "handler t1 open";
where state = "Waiting for table metadata lock" and
info = "handler t1 open";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
......@@ -922,7 +945,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SH lock in incompatible with X lock.
--echo # Sending:
......@@ -934,7 +958,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info like "select column_name from information_schema.columns%";
where state = "Waiting for table metadata lock" and
info like "select column_name from information_schema.columns%";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
......@@ -965,7 +990,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SR lock in incompatible with X lock.
--echo # Sending:
......@@ -977,7 +1003,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "select count(*) from t1";
where state = "Waiting for table metadata lock" and
info = "select count(*) from t1";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
......@@ -1008,7 +1035,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SW lock in incompatible with X lock.
--echo # Sending:
......@@ -1020,7 +1048,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "delete from t1 limit 1";
where state = "Waiting for table metadata lock" and
info = "delete from t1 limit 1";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
......@@ -1051,7 +1080,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SNW lock is incompatible with X lock.
--echo # Sending:
......@@ -1063,7 +1093,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
......@@ -1095,7 +1126,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SNRW lock is incompatible with X lock.
--echo # Sending:
......@@ -1107,7 +1139,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
......@@ -1139,7 +1172,8 @@ connection mdl_con1;
--echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that X lock is incompatible with X lock.
--echo # Sending:
......@@ -1151,7 +1185,8 @@ connection mdl_con2;
--echo # because of X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t3";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t3";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE
unlock tables;
......@@ -1195,7 +1230,8 @@ connection mdl_con1;
--echo # Check that ALTER TABLE is waiting with pending SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Check that S, SH and SR locks are compatible with pending SNW
handler t1 open t;
......@@ -1212,7 +1248,8 @@ connection mdl_con2;
--echo # Check that the above DELETE is blocked because of pending SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "delete from t1 limit 1";
where state = "Waiting for table metadata lock" and
info = "delete from t1 limit 1";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE.
commit;
......@@ -1252,7 +1289,8 @@ connection mdl_con1;
--echo # Check that LOCK TABLE is waiting with pending SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Check that S and SH locks are compatible with pending SNRW
handler t1 open t;
......@@ -1268,7 +1306,8 @@ connection mdl_con2;
--echo # Check that the above SELECT is blocked because of pending SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "select count(*) from t1";
where state = "Waiting for table metadata lock" and
info = "select count(*) from t1";
--source include/wait_condition.inc
--echo # Unblock LOCK TABLE.
commit;
......@@ -1300,7 +1339,8 @@ connection mdl_con1;
--echo # Check that LOCK TABLE is waiting with pending SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Check that SW is incompatible with pending SNRW
--echo # Sending:
......@@ -1311,7 +1351,8 @@ connection mdl_con2;
--echo # Check that the above INSERT is blocked because of pending SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "insert into t1 values (1)";
where state = "Waiting for table metadata lock" and
info = "insert into t1 values (1)";
--source include/wait_condition.inc
--echo # Unblock LOCK TABLE.
commit;
......@@ -1343,7 +1384,8 @@ connection mdl_con1;
--echo # Check that LOCK TABLE is waiting with pending SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Check that SNW is compatible with pending SNRW
--echo # So ALTER TABLE statements are not starved by LOCK TABLEs.
......@@ -1385,7 +1427,8 @@ connection mdl_con1;
--echo # Check that RENAME TABLE is waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SH locks are compatible with pending X
select column_name from information_schema.columns where
......@@ -1399,7 +1442,8 @@ connection mdl_con2;
--echo # Check that the above HANDLER OPEN is blocked because of pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "handler t1 open";
where state = "Waiting for table metadata lock" and
info = "handler t1 open";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
......@@ -1433,7 +1477,8 @@ connection mdl_con1;
--echo # Check that RENAME TABLE is waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SR is incompatible with pending X
--echo # Sending:
......@@ -1444,7 +1489,8 @@ connection mdl_con2;
--echo # Check that the above SELECT is blocked because of pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "select count(*) from t1";
where state = "Waiting for table metadata lock" and
info = "select count(*) from t1";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
......@@ -1477,7 +1523,8 @@ connection mdl_con1;
--echo # Check that RENAME TABLE is waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SW is incompatible with pending X
--echo # Sending:
......@@ -1488,7 +1535,8 @@ connection mdl_con2;
--echo # Check that the above DELETE is blocked because of pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "delete from t1 limit 1";
where state = "Waiting for table metadata lock" and
info = "delete from t1 limit 1";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
......@@ -1521,7 +1569,8 @@ connection mdl_con1;
--echo # Check that RENAME TABLE is waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SNW is incompatible with pending X
--echo # Sending:
......@@ -1532,7 +1581,8 @@ connection mdl_con2;
--echo # Check that the above ALTER TABLE is blocked because of pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
......@@ -1565,7 +1615,8 @@ connection mdl_con1;
--echo # Check that RENAME TABLE is waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that SNRW is incompatible with pending X
--echo # Sending:
......@@ -1576,7 +1627,8 @@ connection mdl_con3;
--echo # Check that the above LOCK TABLES is blocked because of pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'mdl_con2'.
......@@ -1642,7 +1694,8 @@ connection mdl_con2;
--echo # Check that the above INSERT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "insert into t2 values (1)";
where state = "Waiting for table metadata lock" and
info = "insert into t2 values (1)";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE and thus INSERT.
set debug_sync= 'now SIGNAL finish';
......@@ -1691,7 +1744,8 @@ connection mdl_con2;
--echo # Check that the above INSERT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "insert into t1 values (1)";
where state = "Waiting for table metadata lock" and
info = "insert into t1 values (1)";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE and thus INSERT.
set debug_sync= 'now SIGNAL finish';
......@@ -1726,7 +1780,8 @@ connection default;
--echo # Wait until ALTER TABLE starts waiting for SNW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add primary key (c1)";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add primary key (c1)";
--source include/wait_condition.inc
--echo # We should still be able to get both SW and SR locks without waiting.
select count(*) from t1;
......@@ -1769,7 +1824,8 @@ connection default;
--echo # Wait until ALTER TABLE starts waiting X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t2 add column c2 int";
where state = "Waiting for table metadata lock" and
info = "alter table t2 add column c2 int";
--source include/wait_condition.inc
--echo # Check that attempt to acquire SR lock on t2 causes waiting.
--echo # Sending:
......@@ -1780,7 +1836,8 @@ connection mdl_con2;
--echo # Check that the above SELECT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "select count(*) from t2";
where state = "Waiting for table metadata lock" and
info = "select count(*) from t2";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE.
commit;
......@@ -1817,7 +1874,8 @@ connection default;
--echo # Wait until ALTER TABLE starts waiting X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t2 drop column c2";
where state = "Waiting for table metadata lock" and
info = "alter table t2 drop column c2";
--source include/wait_condition.inc
--echo # Check that attempt to acquire SW lock on t2 causes waiting.
--echo # Sending:
......@@ -1828,7 +1886,8 @@ connection mdl_con2;
--echo # Check that the above INSERT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "insert into t2 values (1)";
where state = "Waiting for table metadata lock" and
info = "insert into t2 values (1)";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE.
commit;
......@@ -1861,7 +1920,8 @@ connection default;
--echo # Wait until ALTER TABLE starts waiting X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column c2 int";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column c2 int";
--source include/wait_condition.inc
--echo # Check that transaction is still able to acquire SR lock.
select count(*) from t1;
......@@ -1904,7 +1964,8 @@ connection mdl_con1;
--echo # Check that the above SELECT is blocked
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "select count(*) from t2";
where state = "Waiting for table metadata lock" and
info = "select count(*) from t2";
--source include/wait_condition.inc
--echo # Unblock SELECT.
unlock tables;
......@@ -1934,7 +1995,8 @@ connection mdl_con1;
--echo # Check that the above DELETE is blocked
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "delete from t2 limit 1";
where state = "Waiting for table metadata lock" and
info = "delete from t2 limit 1";
--source include/wait_condition.inc
--echo # Unblock DELETE.
unlock tables;
......@@ -1964,7 +2026,8 @@ connection default;
--echo # Wait until LOCK TABLE is blocked creating pending request for X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Check that another instance of SR lock is granted without waiting.
select count(*) from t1;
......@@ -1999,7 +2062,8 @@ connection default;
--echo # Wait until LOCK TABLE is blocked creating pending request for X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
where state = "Waiting for table metadata lock" and
info = "lock table t1 write";
--source include/wait_condition.inc
--echo # Check that both SR and SW locks are granted without waiting
--echo # and errors.
......@@ -2043,7 +2107,8 @@ connection default;
--echo # Wait until RENAME TABLE starts waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t2 to t3";
where state = "Waiting for table metadata lock" and
info = "rename table t2 to t3";
--source include/wait_condition.inc
--echo # Check that attempt to acquire SR lock on t2 causes waiting.
--echo # Sending:
......@@ -2054,7 +2119,8 @@ connection mdl_con2;
--echo # Check that the above SELECT is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "select count(*) from t2";
where state = "Waiting for table metadata lock" and
info = "select count(*) from t2";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
......@@ -2093,7 +2159,8 @@ connection default;
--echo # Wait until RENAME TABLE starts waiting with pending X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t2 to t3";
where state = "Waiting for table metadata lock" and
info = "rename table t2 to t3";
--source include/wait_condition.inc
--echo # Check that attempt to acquire SW lock on t2 causes waiting.
--echo # Sending:
......@@ -2104,7 +2171,8 @@ connection mdl_con2;
--echo # Check that the above DELETE is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "delete from t2 limit 1";
where state = "Waiting for table metadata lock" and
info = "delete from t2 limit 1";
--source include/wait_condition.inc
--echo # Unblock RENAME TABLE.
commit;
......@@ -2141,7 +2209,8 @@ connection default;
--echo # Wait until RENAME TABLE is blocked creating pending request for X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that another instance of SR lock is granted without waiting.
select count(*) from t1;
......@@ -2176,7 +2245,8 @@ connection default;
--echo # Wait until RENAME TABLE is blocked creating pending request for X lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t2";
--source include/wait_condition.inc
--echo # Check that both SR and SW locks are granted without waiting
--echo # and errors.
......@@ -2236,7 +2306,8 @@ connection handler_con2;
--echo # Wait until ALTER is blocked during upgrade.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column j int";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column j int";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
......@@ -2279,7 +2350,8 @@ connection handler_con1;
--echo # Wait until INSERT is blocked on table-level lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "insert into t2 values (1)";
where state = "Waiting for table level lock" and
info = "insert into t2 values (1)";
--source include/wait_condition.inc
--echo # Sending 'alter table t1 drop column j'. It should not cause
--echo # deadlock.
......@@ -2289,7 +2361,8 @@ connection handler_con2;
--echo # Wait until ALTER is blocked during upgrade.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 drop column j";
where state = "Waiting for table metadata lock" and
info = "alter table t1 drop column j";
--source include/wait_condition.inc
--echo #
--echo # Switching to connection 'default'.
......@@ -2328,7 +2401,8 @@ connection handler_con1;
--echo # Wait until INSERT is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "insert into t1 values (1)";
where state = "Waiting for table metadata lock" and
info = "insert into t1 values (1)";
--source include/wait_condition.inc
--echo # The below ALTER TABLE will be blocked because of presence of HANDLER.
--echo # Sending:
......@@ -2374,7 +2448,8 @@ connection handler_con1;
--echo # Wait until INSERT is blocked because of SNRW lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "insert into t2 values (1)";
where state = "Waiting for table metadata lock" and
info = "insert into t2 values (1)";
--source include/wait_condition.inc
--echo # The below ALTER TABLE will be blocked because of presence of HANDLER.
--echo # Sending:
......@@ -2451,7 +2526,8 @@ connection deadlock_con1;
--echo # for 'deadlock_con2' which holds shared metadata lock on 't2'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t2 to t0, t3 to t2, t0 to t3";
where state = "Waiting for table metadata lock" and
info = "rename table t2 to t0, t3 to t2, t0 to t3";
--source include/wait_condition.inc
--echo # The below statement should wait for exclusive metadata lock
--echo # on 't2' to go away and should not produce ER_LOCK_DEADLOCK
......@@ -2466,7 +2542,8 @@ connection deadlock_con2;
--echo # for an exclusive metadata lock to go away.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "select * from t2";
where state = "Waiting for table metadata lock" and
info = "select * from t2";
--source include/wait_condition.inc
--echo #
--echo # Unblock RENAME TABLE by releasing shared metadata lock on t2.
......@@ -2502,7 +2579,8 @@ connection deadlock_con1;
--echo # table 't1'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t0, t3 to t1, t0 to t3";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t0, t3 to t1, t0 to t3";
--source include/wait_condition.inc
--echo # Commit transaction to unblock RENAME TABLE.
commit;
......@@ -2536,7 +2614,8 @@ connection deadlock_con1;
--echo # for 'deadlock_con1' which holds shared metadata lock on 't2'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t2 to t0, t1 to t2, t0 to t1";
where state = "Waiting for table metadata lock" and
info = "rename table t2 to t0, t1 to t2, t0 to t1";
--source include/wait_condition.inc
--echo #
--echo # The below statement should not wait as doing so will cause deadlock.
......@@ -2549,7 +2628,8 @@ select * from t1;
--echo # metadata lock on table 't1', i.e. that RENAME TABLE is still blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t2 to t0, t1 to t2, t0 to t1";
where state = "Waiting for table metadata lock" and
info = "rename table t2 to t0, t1 to t2, t0 to t1";
--source include/wait_condition.inc
--echo # Commit transaction to unblock RENAME TABLE.
commit;
......@@ -2590,7 +2670,7 @@ connection deadlock_con2;
--echo # for an UNRW metadata lock to go away.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "select * from t1";
where state = "Waiting for table metadata lock" and info = "select * from t1";
--source include/wait_condition.inc
--echo # Send RENAME TABLE statement that will deadlock with the
......@@ -2604,7 +2684,8 @@ connection default;
--echo # pending X lock on t1.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t0, t2 to t1, t0 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t0, t2 to t1, t0 to t2";
--source include/wait_condition.inc
--echo # Allow the above RENAME TABLE to acquire lock on t1 and
--echo # create pending lock on t2 thus creating deadlock.
......@@ -2626,7 +2707,8 @@ connection deadlock_con1;
--echo # is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "rename table t1 to t0, t2 to t1, t0 to t2";
where state = "Waiting for table metadata lock" and
info = "rename table t1 to t0, t2 to t1, t0 to t2";
--source include/wait_condition.inc
--echo # Commit transaction to unblock this RENAME TABLE.
commit;
......@@ -2674,7 +2756,8 @@ connection deadlock_con1;
--echo # 'deadlock_con1' which holds shared lock on 't1'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column j int, rename to t2";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column j int, rename to t2";
--source include/wait_condition.inc
--echo # The below statement should not wait as it will cause deadlock.
......@@ -2687,7 +2770,8 @@ select * from t2;
--echo # so ALTER TABLE ... RENAME is still blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column j int, rename to t2";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column j int, rename to t2";
--source include/wait_condition.inc
--echo # Commit transaction to unblock ALTER TABLE ... RENAME.
......@@ -2732,7 +2816,8 @@ connection deadlock_con2;
--echo # while trying to acquire SNRW lock on 't1'.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock tables t1 write, t2 write";
where state = "Waiting for table metadata lock" and
info = "lock tables t1 write, t2 write";
--source include/wait_condition.inc
--echo # Resume SELECT execution, this should eventually unblock LOCK TABLES.
set debug_sync= 'now SIGNAL finish';
......@@ -2801,7 +2886,8 @@ connection deadlock_con2;
--echo # Wait until ALTER is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 drop column j";
where state = "Waiting for table metadata lock" and
info = "alter table t1 drop column j";
--source include/wait_condition.inc
--echo # Resume INSERT so it can start deadlock detection.
--echo #
......@@ -2873,7 +2959,7 @@ connection default;
--echo # metadata lock on its tables and blocks due to 't4' being used by LOCK
--echo # TABLES.
let $wait_condition= select count(*)= 1 from information_schema.processlist
where state= 'Waiting for table' and
where state= 'Waiting for table metadata lock' and
info='rename table t3 to t5, t4 to t3';
--source include/wait_condition.inc
--echo # Send :
......@@ -2884,7 +2970,7 @@ connection con1root;
--echo # Wait until INSERT statement waits due to encountering pending
--echo # exclusive metadata lock on 't3'.
let $wait_condition= select count(*)= 1 from information_schema.processlist
where state= 'Waiting for table' and
where state= 'Waiting for table metadata lock' and
info='insert into t1 values (1)';
--source include/wait_condition.inc
unlock tables;
......@@ -3026,7 +3112,8 @@ connection default;
--echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "create table t2 select * from t1 for update";
where state = "Waiting for table level lock" and
info = "create table t2 select * from t1 for update";
--source include/wait_condition.inc
--echo # First let us check that SHOW FIELDS/DESCRIBE doesn't
......@@ -3079,7 +3166,8 @@ connection default;
--echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "create table t2 select * from t1 for update";
where state = "Waiting for table level lock" and
info = "create table t2 select * from t1 for update";
--source include/wait_condition.inc
--echo # Let us check that SHOW FIELDS/DESCRIBE gets blocked.
......@@ -3091,7 +3179,8 @@ connection con46044_2;
--echo # Wait until SHOW FIELDS gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "show fields from t2";
where state = "Waiting for table metadata lock" and
info = "show fields from t2";
--source include/wait_condition.inc
unlock tables;
......@@ -3121,7 +3210,8 @@ connection default;
--echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "create table t2 select * from t1 for update";
where state = "Waiting for table level lock" and
info = "create table t2 select * from t1 for update";
--source include/wait_condition.inc
--echo # Check that I_S query which reads only .FRMs gets blocked.
......@@ -3133,7 +3223,7 @@ connection con46044_2;
--echo # Wait until SELECT COLUMN_NAME FROM I_S.COLUMNS gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info like "select column_name from information_schema.columns%";
--source include/wait_condition.inc
......@@ -3164,7 +3254,8 @@ connection default;
--echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and info = "create table t2 select * from t1 for update";
where state = "Waiting for table level lock" and
info = "create table t2 select * from t1 for update";
--source include/wait_condition.inc
--echo # Finally, check that I_S query which does full-blown table open
......@@ -3177,7 +3268,7 @@ connection con46044_2;
--echo # Wait until SELECT ... FROM I_S.TABLES gets blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and
where state = "Waiting for table metadata lock" and
info like "select table_name, table_type, auto_increment, table_comment from information_schema.tables%";
--source include/wait_condition.inc
......@@ -3240,7 +3331,8 @@ update t1 set c3=c3+1 where c2 = 3;
--echo # metadata lock on table 't1', i.e. that ALTER TABLE is still blocked.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "alter table t1 add column e int, rename to t2";
where state = "Waiting for table metadata lock" and
info = "alter table t1 add column e int, rename to t2";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE by commiting transaction and thus releasing
......@@ -3425,7 +3517,7 @@ connection con1;
connection con3;
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = "Table lock" and info = "SELECT 1";
WHERE state = "Waiting for table level lock" and info = "SELECT 1";
--source include/wait_condition.inc
# The ALTER below will try to abort the statement in connection con1,
# since the latter waits on a table-level lock while having a HANDLER
......@@ -3495,7 +3587,8 @@ connection con50913_2;
--echo # Wait until TRUNCATE TABLE is blocked on MDL lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "truncate table t1";
where state = "Waiting for table metadata lock" and
info = "truncate table t1";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE.
set debug_sync= 'now SIGNAL go';
......@@ -3568,7 +3661,8 @@ connection con3;
--echo # SW lock on the table.
let $wait_condition=
select count(*) = 2 from information_schema.processlist
where state = "Waiting for table" and info = "insert into t1 values (1)";
where state = "Waiting for table metadata lock" and
info = "insert into t1 values (1)";
--source include/wait_condition.inc
--echo # Unblock ALTER TABLE. Since it will try to upgrade SNW to X lock
--echo # deadlock with two loops in waiting graph will occur. Both loops
......@@ -3738,7 +3832,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' AND info='CREATE DATABASE db1';
WHERE state='Waiting for schema metadata lock' AND info='CREATE DATABASE db1';
--source include/wait_condition.inc
# This should not block.
CREATE DATABASE db2;
......@@ -3778,7 +3872,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table'
WHERE state='Waiting for schema metadata lock'
AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
--source include/wait_condition.inc
# This should not block.
......@@ -3813,7 +3907,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' AND info='DROP DATABASE db1';
WHERE state='Waiting for schema metadata lock' AND info='DROP DATABASE db1';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
......@@ -3857,7 +3951,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table'
WHERE state='Waiting for schema metadata lock'
AND info='ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME';
--source include/wait_condition.inc
# This should not block.
......@@ -3898,7 +3992,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' AND info='DROP DATABASE db1';
WHERE state='Waiting for schema metadata lock' AND info='DROP DATABASE db1';
--source include/wait_condition.inc
# This should not block.
CREATE DATABASE db2;
......@@ -3934,7 +4028,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table'
WHERE state='Waiting for schema metadata lock'
AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
......@@ -3973,7 +4067,8 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' AND info='CREATE TABLE db1.t1 (a INT)';
WHERE state='Waiting for schema metadata lock' AND
info='CREATE TABLE db1.t1 (a INT)';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
......@@ -4011,7 +4106,8 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' AND info='RENAME TABLE db1.t1 TO test.t1';
WHERE state='Waiting for schema metadata lock' AND
info='RENAME TABLE db1.t1 TO test.t1';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
......@@ -4044,7 +4140,8 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' AND info='RENAME TABLE test.t2 TO db1.t2';
WHERE state='Waiting for schema metadata lock' AND
info='RENAME TABLE test.t2 TO db1.t2';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
......@@ -4084,7 +4181,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' AND info='DROP TABLE db1.t1';
WHERE state='Waiting for schema metadata lock' AND info='DROP TABLE db1.t1';
--source include/wait_condition.inc
SET DEBUG_SYNC= 'now SIGNAL blocked';
......
......@@ -51,7 +51,7 @@ connection default;
#--sleep 8
#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID = $con1_id AND STATE = 'Waiting for table';
WHERE ID = $con1_id AND STATE = 'Waiting for table metadata lock';
--source include/wait_condition.inc
#SELECT NOW();
--echo # Kick INSERT out of thr_multi_lock().
......@@ -61,7 +61,7 @@ FLUSH TABLES;
#--sleep 8
#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID = $con1_id AND STATE = 'Waiting for table';
WHERE ID = $con1_id AND STATE = 'Waiting for table metadata lock';
--source include/wait_condition.inc
#SELECT NOW();
--echo # Unlock and close table and wait for con1 to close too.
......
......@@ -497,7 +497,7 @@ connection updater;
# Wait till "alter table t1 ..." of session changer is in work.
# = There is one session waiting.
let $wait_condition= select count(*)= 1 from information_schema.processlist
where state= 'Waiting for table';
where state= 'Waiting for table metadata lock';
--source include/wait_condition.inc
send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
......@@ -508,7 +508,7 @@ connection locker;
# are in work.
# = There are two session waiting.
let $wait_condition= select count(*)= 2 from information_schema.processlist
where state= 'Waiting for table';
where state= 'Waiting for table metadata lock';
--source include/wait_condition.inc
unlock tables;
......
......@@ -498,12 +498,20 @@ drop table t1,t2,t3,t4;
set query_cache_wlock_invalidate=1;
create table t1 (a int not null);
create table t2 (a int not null);
create view v1 as select * from t1;
select * from t1;
select * from t2;
show status like "Qcache_queries_in_cache";
lock table t1 write, t2 read;
show status like "Qcache_queries_in_cache";
unlock table;
select * from t1;
# Implicit locking of t1 does not invalidate QC
show status like "Qcache_queries_in_cache";
lock table v1 write;
show status like "Qcache_queries_in_cache";
unlock table;
drop view v1;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
......
......@@ -58,18 +58,18 @@ connection user3;
# Typical information_schema.processlist content after sufficient sleep time
# ID USER COMMAND TIME STATE INFO
# ....
# 2 root Query 5 Table lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
# 2 root Query 5 Waiting for table level lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
# ....
# XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# The values marked with 'X' must be reached.
--echo # Poll till the select of connection user1 is blocked by the write lock on t1.
let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE state = 'Table lock'
WHERE state = 'Waiting for table level lock'
AND info = '$select_for_qc';
--source include/wait_condition.inc
eval
SELECT user,command,state,info FROM information_schema.processlist
WHERE state = 'Table lock'
WHERE state = 'Waiting for table level lock'
AND info = '$select_for_qc';
INSERT INTO t1 VALUES (4);
......
......@@ -45,7 +45,7 @@ connection con2;
--echo # Connection default
connection default;
let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
WHERE state= 'Waiting for table'
WHERE state= 'Waiting for table metadata lock'
AND info='DROP SCHEMA schema1';
--source include/wait_condition.inc
ALTER SCHEMA schema2 DEFAULT CHARACTER SET utf8;
......@@ -84,7 +84,7 @@ connection con2;
--echo # Connection default
connection default;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' and info='DROP SCHEMA schema1';
WHERE state='Waiting for schema metadata lock' and info='DROP SCHEMA schema1';
--source include/wait_condition.inc
--echo # CREATE SCHEMA used to give a deadlock.
......@@ -124,7 +124,7 @@ connection default;
--echo # Connection con2
connect (con2, localhost, root);
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' AND info='DROP DATABASE db1';
WHERE state='Waiting for table metadata lock' AND info='DROP DATABASE db1';
--source include/wait_condition.inc
--echo # Connection con1
......@@ -172,7 +172,7 @@ connection con2;
--echo # Connection 3
connection con3;
let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table' and info='DROP DATABASE db1';
WHERE state='Waiting for table metadata lock' and info='DROP DATABASE db1';
--source include/wait_condition.inc
--echo # But it should still be possible to CREATE/ALTER/DROP other databases.
CREATE DATABASE db2;
......
......@@ -183,18 +183,19 @@ connection con1;
send drop procedure p1;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'drop procedure t1' to get blocked on MDL lock...
--echo # Waiting for 'drop procedure t1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='drop procedure p1';
where state='Waiting for stored procedure metadata lock' and
info='drop procedure p1';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
--echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='select f1()';
where state='Waiting for stored procedure metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
......@@ -222,18 +223,19 @@ connection con1;
send create procedure p1() begin end;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'create procedure t1' to get blocked on MDL lock...
--echo # Waiting for 'create procedure t1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='create procedure p1() begin end';
where state='Waiting for stored procedure metadata lock' and
info='create procedure p1() begin end';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
--echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='select f1()';
where state='Waiting for stored procedure metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
......@@ -259,18 +261,19 @@ connection con1;
send alter procedure p1 contains sql;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'alter procedure t1' to get blocked on MDL lock...
--echo # Waiting for 'alter procedure t1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='alter procedure p1 contains sql';
where state='Waiting for stored procedure metadata lock' and
info='alter procedure p1 contains sql';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
--echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='select f1()';
where state='Waiting for stored procedure metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
......@@ -296,18 +299,19 @@ connection con1;
send drop function f1;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'drop function f1' to get blocked on MDL lock...
--echo # Waiting for 'drop function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='drop function f1';
where state='Waiting for stored function metadata lock' and
info='drop function f1';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
--echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='select f1()';
where state='Waiting for stored function metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
......@@ -335,18 +339,19 @@ connection con1;
send create function f1() returns int return 2;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'create function f1' to get blocked on MDL lock...
--echo # Waiting for 'create function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='create function f1() returns int return 2';
where state='Waiting for stored function metadata lock' and
info='create function f1() returns int return 2';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
--echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='select f1()';
where state='Waiting for stored function metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
......@@ -373,18 +378,19 @@ connection con1;
send alter function f1 contains sql;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'alter function f1' to get blocked on MDL lock...
--echo # Waiting for 'alter function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='alter function f1 contains sql';
where state='Waiting for stored function metadata lock' and
info='alter function f1 contains sql';
--source include/wait_condition.inc
--echo # Demonstrate that there is a pending exclusive lock.
--echo # Sending 'select f1()'...
send select f1();
--echo # --> connection con3
connection con3;
--echo # Waitng for 'select f1()' to get blocked by a pending MDL lock...
--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='select f1()';
where state='Waiting for stored function metadata lock' and info='select f1()';
--echo # --> connection default
connection default;
commit;
......@@ -471,9 +477,10 @@ connection con1;
send drop function f1;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'drop function f1' to get blocked on MDL lock...
--echo # Waiting for 'drop function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='drop function f1';
where state='Waiting for stored function metadata lock' and
info='drop function f1';
--source include/wait_condition.inc
--echo # --> connnection default
connection default;
......@@ -497,9 +504,10 @@ connection con1;
send drop function f1;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'drop function f1' to get blocked on MDL lock...
--echo # Waiting for 'drop function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='drop function f1';
where state='Waiting for stored function metadata lock' and
info='drop function f1';
--source include/wait_condition.inc
--echo # --> connnection default
connection default;
......@@ -530,9 +538,10 @@ connection con1;
send drop procedure p1;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'drop procedure p1' to get blocked on MDL lock...
--echo # Waiting for 'drop procedure p1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='drop procedure p1';
where state='Waiting for stored procedure metadata lock' and
info='drop procedure p1';
--source include/wait_condition.inc
--echo # --> connnection default
connection default;
......@@ -561,9 +570,10 @@ connection con1;
send drop function f2;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'drop function f2' to get blocked on MDL lock...
--echo # Waiting for 'drop function f2' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='drop function f2';
where state='Waiting for stored function metadata lock' and
info='drop function f2';
--source include/wait_condition.inc
--echo # --> connnection default
connection default;
......@@ -623,17 +633,19 @@ connection con1;
send drop function f1;
--echo # --> connection con2
connection con2;
--echo # Waitng for 'drop function f1' to get blocked on MDL lock...
--echo # Waiting for 'drop function f1' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='drop function f1';
where state='Waiting for stored function metadata lock' and
info='drop function f1';
--source include/wait_condition.inc
--echo # Sending 'drop function f2'...
send drop function f2;
--echo # --> connection default
connection default;
--echo # Waitng for 'drop function f2' to get blocked on MDL lock...
--echo # Waiting for 'drop function f2' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='drop function f2';
where state='Waiting for stored function metadata lock' and
info='drop function f2';
--source include/wait_condition.inc
rollback to savepoint sv;
--echo # --> connection con2
......@@ -699,16 +711,18 @@ connection con1;
send alter function f1 comment "comment";
--echo # --> connection con2
connection con2;
--echo # Waitng for 'alter function f1 ...' to get blocked on MDL lock...
--echo # Waiting for 'alter function f1 ...' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info like 'alter function f1 comment%';
where state='Waiting for stored function metadata lock' and
info like 'alter function f1 comment%';
--source include/wait_condition.inc
--echo # Sending 'call p1()'...
send call p1();
connection default;
--echo # Waitng for 'call p1()' to get blocked on MDL lock on f1...
--echo # Waiting for 'call p1()' to get blocked on MDL lock on f1...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='select f1() into @var';
where state='Waiting for stored function metadata lock' and
info='select f1() into @var';
--source include/wait_condition.inc
--echo # Let 'alter function f1 ...' go through...
commit;
......@@ -746,9 +760,10 @@ connection con1;
send alter function f1 comment "comment";
--echo # --> connection con2
connection con2;
--echo # Waitng for 'alter function f1 ...' to get blocked on MDL lock...
--echo # Waiting for 'alter function f1 ...' to get blocked on MDL lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info like 'alter function f1 comment%';
where state='Waiting for stored function metadata lock' and
info like 'alter function f1 comment%';
--source include/wait_condition.inc
delimiter |;
--echo #
......@@ -774,9 +789,10 @@ delimiter ;|
--echo # Sending 'call p1()'...
send call p1();
connection default;
--echo # Waitng for 'call p1()' to get blocked on MDL lock on f1...
--echo # Waiting for 'call p1()' to get blocked on MDL lock on f1...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='Waiting for table' and info='select f1() into @var';
where state='Waiting for stored function metadata lock' and
info='select f1() into @var';
--source include/wait_condition.inc
--echo # Let 'alter function f1 ...' go through...
commit;
......@@ -825,7 +841,7 @@ connection default;
send select f3();
--echo # --> connection con1
connection con1;
--echo # Waitng for 'select f3()' to get blocked on the user level lock...
--echo # Waiting for 'select f3()' to get blocked on the user level lock...
let $wait_condition=select count(*)=1 from information_schema.processlist
where state='User lock' and info='select f1() into @var';
--source include/wait_condition.inc
......
......@@ -322,7 +322,7 @@ set session low_priority_updates=on;
connection rl_wait;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Table lock" and
where state = "Waiting for table level lock" and
info = "update t1 set value='updated' where value='old'";
--source include/wait_condition.inc
......
......@@ -87,7 +87,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked';
--echo # Connection con3
connection con3;
let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
WHERE state= 'Waiting for table'
WHERE state= 'Waiting for stored function metadata lock'
AND info='SHOW OPEN TABLES WHERE f1()=0';
--source include/wait_condition.inc
--echo # Check that the IS query is blocked before releasing the x-lock
......
......@@ -58,7 +58,8 @@ let $ID= `select connection_id()`;
connection con2;
--echo # Switched to connection: con2
# wait for the other query to start executing
let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST where ID = $ID and STATE = "Table lock";
let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST
where ID = $ID and STATE = "Waiting for table level lock";
--source include/wait_condition.inc
unlock tables;
......
......@@ -896,7 +896,7 @@ connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table";
where state = "Waiting for global metadata lock";
--source include/wait_condition.inc
create trigger t1_bi before insert on t1 for each row begin end;
unlock tables;
......
......@@ -4074,7 +4074,8 @@ connection default;
connection con2;
let $wait_condition=
SELECT COUNT(*) = 1 from information_schema.processlist
WHERE state = "Table lock" AND info = "INSERT INTO t1 SELECT * FROM v1";
WHERE state = "Waiting for table level lock" AND
info = "INSERT INTO t1 SELECT * FROM v1";
--source include/wait_condition.inc
--echo # ... then try to drop the view. This should block.
--echo # Sending:
......@@ -4084,7 +4085,7 @@ let $wait_condition=
connection con3;
let $wait_condition=
SELECT COUNT(*) = 1 from information_schema.processlist
WHERE state = "Waiting for table" AND info = "DROP VIEW v1";
WHERE state = "Waiting for table metadata lock" AND info = "DROP VIEW v1";
--source include/wait_condition.inc
--echo # Now allow CALL p1() to complete
UNLOCK TABLES;
......
......@@ -428,7 +428,7 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
thread_var->current_cond= cond;
data->cond= cond;
old_proc_info= proc_info_hook(NULL, "Table lock",
old_proc_info= proc_info_hook(NULL, "Waiting for table level lock",
__func__, __FILE__, __LINE__);
set_timespec(wait_timeout, lock_wait_timeout);
......
......@@ -71,6 +71,21 @@ static void init_mdl_psi_keys(void)
void notify_shared_lock(THD *thd, MDL_ticket *conflicting_ticket);
/**
Thread state names to be used in case when we have to wait on resource
belonging to certain namespace.
*/
const char *MDL_key::m_namespace_to_wait_state_name[NAMESPACE_END]=
{
"Waiting for global metadata lock",
"Waiting for schema metadata lock",
"Waiting for table metadata lock",
"Waiting for stored function metadata lock",
"Waiting for stored procedure metadata lock",
NULL
};
static bool mdl_initialized= 0;
......@@ -946,17 +961,18 @@ void MDL_wait::reset_status()
Wait for the status to be assigned to this wait slot.
@param abs_timeout Absolute time after which waiting should stop.
@param set_status_on_tiemout TRUE - If in case of timeout waiting
@param set_status_on_timeout TRUE - If in case of timeout waiting
context should close the wait slot by
sending TIMEOUT to itself.
FALSE - Otherwise.
@param wait_state_name Thread state name to be set for duration of wait.
@returns Signal posted.
*/
MDL_wait::enum_wait_status
MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout,
bool set_status_on_timeout)
bool set_status_on_timeout, const char *wait_state_name)
{
const char *old_msg;
enum_wait_status result;
......@@ -965,7 +981,7 @@ MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout,
mysql_mutex_lock(&m_LOCK_wait_status);
old_msg= thd_enter_cond(thd, &m_COND_wait_status, &m_LOCK_wait_status,
"Waiting for table");
wait_state_name);
while (!m_wait_status && !thd_killed(thd) &&
wait_result != ETIMEDOUT && wait_result != ETIME)
......@@ -1746,7 +1762,8 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
while (cmp_timespec(abs_shortwait, abs_timeout) <= 0)
{
/* abs_timeout is far away. Wait a short while and notify locks. */
wait_status= m_wait.timed_wait(m_thd, &abs_shortwait, FALSE);
wait_status= m_wait.timed_wait(m_thd, &abs_shortwait, FALSE,
mdl_request->key.get_wait_state_name());
if (wait_status != MDL_wait::EMPTY)
break;
......@@ -1757,10 +1774,12 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
set_timespec(abs_shortwait, 1);
}
if (wait_status == MDL_wait::EMPTY)
wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE);
wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE,
mdl_request->key.get_wait_state_name());
}
else
wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE);
wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE,
mdl_request->key.get_wait_state_name());
done_waiting_for();
......
......@@ -184,7 +184,9 @@ class MDL_key
TABLE,
FUNCTION,
PROCEDURE,
TRIGGER };
TRIGGER,
/* This should be the last ! */
NAMESPACE_END };
const uchar *ptr() const { return (uchar*) m_ptr; }
uint length() const { return m_length; }
......@@ -251,10 +253,20 @@ class MDL_key
}
MDL_key() {} /* To use when part of MDL_request. */
/**
Get thread state name to be used in case when we have to
wait on resource identified by key.
*/
const char * get_wait_state_name() const
{
return m_namespace_to_wait_state_name[(int)mdl_namespace()];
}
private:
uint16 m_length;
uint16 m_db_name_length;
char m_ptr[MAX_MDLKEY_LENGTH];
static const char * m_namespace_to_wait_state_name[NAMESPACE_END];
private:
MDL_key(const MDL_key &); /* not implemented */
MDL_key &operator=(const MDL_key &); /* not implemented */
......@@ -462,7 +474,7 @@ class MDL_wait
enum_wait_status get_status();
void reset_status();
enum_wait_status timed_wait(THD *thd, struct timespec *abs_timeout,
bool signal_timeout);
bool signal_timeout, const char *wait_state_name);
private:
/**
Condvar which is used for waiting until this context's pending
......
......@@ -8772,7 +8772,8 @@ tdc_wait_for_old_versions(THD *thd, MDL_request_list *mdl_requests,
my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
break;
}
old_msg= thd->enter_cond(&COND_refresh, &LOCK_open, "Waiting for table");
old_msg= thd->enter_cond(&COND_refresh, &LOCK_open,
"Waiting for table flush");
wait_result= mysql_cond_timedwait(&COND_refresh, &LOCK_open, &abstime);
/* LOCK_open mutex is unlocked by THD::exit_cond() as side-effect. */
thd->exit_cond(old_msg);
......
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