| 1 |
# Tests for PERFORMANCE_SCHEMA |
| 2 |
|
| 3 |
# Setup |
| 4 |
--source include/have_myisam.inc |
| 5 |
--source include/force_myisam_default.inc |
| 6 |
update performance_schema.setup_instruments set enabled='NO'; |
| 7 |
update performance_schema.setup_instruments set enabled='YES' |
| 8 |
where name like "wait/io/file/myisam/%"; |
| 9 |
|
| 10 |
update performance_schema.setup_consumers |
| 11 |
set enabled='YES'; |
| 12 |
|
| 13 |
truncate table performance_schema.events_waits_history_long; |
| 14 |
|
| 15 |
# Reset lost counters to a known state |
| 16 |
truncate table performance_schema.events_statements_summary_by_digest; |
| 17 |
flush status; |
| 18 |
|
| 19 |
# Code to test |
| 20 |
|
| 21 |
--disable_warnings |
| 22 |
drop table if exists test.no_index_tab; |
| 23 |
--enable_warnings |
| 24 |
|
| 25 |
create table test.no_index_tab ( a varchar(255), b int ) engine=myisam; |
| 26 |
insert into no_index_tab set a = 'foo', b = 1; |
| 27 |
insert into no_index_tab set a = 'foo', b = 1; |
| 28 |
insert into no_index_tab set a = 'foo', b = 1; |
| 29 |
|
| 30 |
# Verification |
| 31 |
# Note that mi_create.c contains mysql_file_tell() calls in debug only, |
| 32 |
# so the result are filtered to remove 'tell'. |
| 33 |
# Note that even after setting other instruments to enabled='NO' |
| 34 |
# and truncating the events_waits_history_long table, |
| 35 |
# some events -- that were already started but not completed -- |
| 36 |
# for other instruments could still be added in the history. |
| 37 |
# To protect against that, an extra where clause |
| 38 |
# "and event_name like "wait/io/file/myisam/%" |
| 39 |
# is added to the select to filter out the result. |
| 40 |
|
| 41 |
select event_name, |
| 42 |
left(source, locate(":", source)) as short_source, |
| 43 |
operation, number_of_bytes, |
| 44 |
substring(object_name, locate("no_index_tab", object_name)) as short_name |
| 45 |
from performance_schema.events_waits_history_long |
| 46 |
where operation not like "tell" |
| 47 |
and event_name like "wait/io/file/myisam/%" |
| 48 |
order by thread_id, event_id; |
| 49 |
|
| 50 |
# In case of failures, this will tell if file io are lost. |
| 51 |
show global status like 'performance_schema_%_lost'; |
| 52 |
|
| 53 |
# Cleanup |
| 54 |
|
| 55 |
update performance_schema.setup_instruments set enabled='YES'; |
| 56 |
|
| 57 |
drop table test.no_index_tab; |
| 58 |
|