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