| 1 |
# Tests for PERFORMANCE_SCHEMA |
| 2 |
|
| 3 |
--source include/not_embedded.inc |
| 4 |
--source include/have_perfschema.inc |
| 5 |
|
| 6 |
# Setup |
| 7 |
|
| 8 |
--source ../include/setup_helper.inc |
| 9 |
|
| 10 |
# We use a myisam table here because CREATE TABLE has a known, |
| 11 |
# stable behavior (it will lock THR_LOCK_myisam once). |
| 12 |
# The point is not to test myisam, but to test that each |
| 13 |
# connection is properly instrumented, with one-thread-per-connection |
| 14 |
|
| 15 |
update performance_schema.setup_instruments set enabled='YES' |
| 16 |
where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; |
| 17 |
|
| 18 |
--disable_warnings |
| 19 |
drop table if exists test.t1; |
| 20 |
drop table if exists test.t2; |
| 21 |
drop table if exists test.t3; |
| 22 |
--enable_warnings |
| 23 |
|
| 24 |
truncate table performance_schema.events_waits_history_long; |
| 25 |
|
| 26 |
show global variables like "thread_handling"; |
| 27 |
|
| 28 |
# Code to test |
| 29 |
|
| 30 |
connection con1; |
| 31 |
create table test.t1(a int) engine=MYISAM; |
| 32 |
|
| 33 |
connection con2; |
| 34 |
create table test.t2(a int) engine=MYISAM; |
| 35 |
|
| 36 |
connection con3; |
| 37 |
create table test.t3(a int) engine=MYISAM; |
| 38 |
|
| 39 |
# Verification |
| 40 |
|
| 41 |
connection default; |
| 42 |
--disable_query_log |
| 43 |
eval set @tid= $con1_THREAD_ID; |
| 44 |
--enable_query_log |
| 45 |
|
| 46 |
execute stmt_dump_events using @tid; |
| 47 |
execute stmt_dump_thread using @tid; |
| 48 |
|
| 49 |
--disable_query_log |
| 50 |
eval set @tid= $con2_THREAD_ID; |
| 51 |
--enable_query_log |
| 52 |
|
| 53 |
execute stmt_dump_events using @tid; |
| 54 |
execute stmt_dump_thread using @tid; |
| 55 |
|
| 56 |
--disable_query_log |
| 57 |
eval set @tid= $con3_THREAD_ID; |
| 58 |
--enable_query_log |
| 59 |
|
| 60 |
execute stmt_dump_events using @tid; |
| 61 |
execute stmt_dump_thread using @tid; |
| 62 |
|
| 63 |
# Cleanup |
| 64 |
|
| 65 |
drop table test.t1; |
| 66 |
drop table test.t2; |
| 67 |
drop table test.t3; |
| 68 |
|
| 69 |
--source ../include/cleanup_helper.inc |
| 70 |
|