diff options
Diffstat (limited to 'mysql-test/suite/perfschema/t/stage_mdl_table.test')
-rw-r--r-- | mysql-test/suite/perfschema/t/stage_mdl_table.test | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/mysql-test/suite/perfschema/t/stage_mdl_table.test b/mysql-test/suite/perfschema/t/stage_mdl_table.test new file mode 100644 index 00000000000..b522f51a68e --- /dev/null +++ b/mysql-test/suite/perfschema/t/stage_mdl_table.test @@ -0,0 +1,59 @@ +# Tests for the performance schema +# + +--source ../include/stage_setup.inc + +connect (con1, localhost, user1, , ); + +begin; +insert into test.t1 values (1), (2), (3); +commit; + +begin; +select * from test.t1 for update; + +connect (con2, localhost, user2, , ); + +# Will wait on con1, "Waiting for table metadata lock" +--send +alter table test.t1 add column (b int); + +--connection default + +# user1: Wait for the statement to complete +let $wait_condition= + select count(*) = 1 from performance_schema.threads + where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user1' + and PROCESSLIST_COMMAND = 'Sleep'; +--source include/wait_condition.inc + +# user2: Wait for the alter to block +let $wait_condition= + select count(*) = 1 from performance_schema.threads + where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user2' + and PROCESSLIST_STATE = 'Waiting for table metadata lock'; +--source include/wait_condition.inc + +call dump_one_thread('user1'); +call dump_one_thread('user2'); + +--connection con1 +commit; + +--disconnect con1 + +--connection con2 +--reap + +--disconnect con2 + +--connection default + +# Wait for the disconnects to complete +let $wait_condition= + select count(*) = 0 from performance_schema.threads + where `TYPE`='FOREGROUND' and PROCESSLIST_USER like 'user%'; +--source include/wait_condition.inc + +--source ../include/stage_cleanup.inc + |