| 1 |
# Tests for PERFORMANCE_SCHEMA |
| 2 |
--source include/have_myisam.inc |
| 3 |
--source include/force_myisam_default.inc |
| 4 |
--source include/not_threadpool.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 |
|
| 32 |
-- echo "----------------- Connection 1" |
| 33 |
create table test.t1(a int) engine=MYISAM; |
| 34 |
|
| 35 |
connection con2; |
| 36 |
|
| 37 |
-- echo "----------------- Connection 2" |
| 38 |
create table test.t2(a int) engine=MYISAM; |
| 39 |
|
| 40 |
connection con3; |
| 41 |
|
| 42 |
-- echo "----------------- Connection 3" |
| 43 |
create table test.t3(a int) engine=MYISAM; |
| 44 |
|
| 45 |
# Verification |
| 46 |
|
| 47 |
connection default; |
| 48 |
|
| 49 |
-- echo "----------------- Connection default" |
| 50 |
|
| 51 |
--disable_query_log |
| 52 |
eval set @tid= $con1_THREAD_ID; |
| 53 |
--enable_query_log |
| 54 |
|
| 55 |
execute stmt_dump_events using @tid; |
| 56 |
execute stmt_dump_thread using @tid; |
| 57 |
|
| 58 |
--disable_query_log |
| 59 |
eval set @tid= $con2_THREAD_ID; |
| 60 |
--enable_query_log |
| 61 |
|
| 62 |
execute stmt_dump_events using @tid; |
| 63 |
execute stmt_dump_thread using @tid; |
| 64 |
|
| 65 |
--disable_query_log |
| 66 |
eval set @tid= $con3_THREAD_ID; |
| 67 |
--enable_query_log |
| 68 |
|
| 69 |
execute stmt_dump_events using @tid; |
| 70 |
execute stmt_dump_thread using @tid; |
| 71 |
|
| 72 |
# Cleanup |
| 73 |
|
| 74 |
drop table test.t1; |
| 75 |
drop table test.t2; |
| 76 |
drop table test.t3; |
| 77 |
|
| 78 |
--source ../include/cleanup_helper.inc |
| 79 |
|