# Tests for the performance schema # --source include/not_valgrind.inc --source ../include/stage_setup.inc begin; insert into test.t1 values (1), (2), (3); commit; connect (con1, localhost, user1, , ); let $con1_thread_id= `select THREAD_ID from performance_schema.threads where PROCESSLIST_ID = connection_id()`; # Make sure this thread is instrumented select INSTRUMENTED, HISTORY from performance_schema.threads where PROCESSLIST_ID = connection_id(); begin; LOCK TABLE test.t1 READ LOCAL; connect (con2, localhost, user2, , ); let $con2_thread_id= `select THREAD_ID from performance_schema.threads where PROCESSLIST_ID = connection_id()`; # Make sure this thread is instrumented select INSTRUMENTED, HISTORY from performance_schema.threads where PROCESSLIST_ID = connection_id(); # Will wait on con1, "Waiting for table metadata lock" --send insert into test.t1 values(4); --connection default select * from performance_schema.threads where PROCESSLIST_USER like 'user1'; eval select * from performance_schema.metadata_locks where OWNER_THREAD_ID=$con1_thread_id; select * from performance_schema.threads where PROCESSLIST_USER like 'user2'; eval select * from performance_schema.metadata_locks where OWNER_THREAD_ID=$con2_thread_id; call dump_one_thread('user1'); call dump_one_thread('user2'); --connection con1 UNLOCK TABLES; --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