1
# Tests for PERFORMANCE_SCHEMA
3
--source include/have_log_bin.inc
4
--source include/not_embedded.inc
5
--source include/have_perfschema.inc
6
--source include/master-slave.inc
9
drop table if exists test.t1;
10
--sync_slave_with_master
14
create table test.t1(a int);
17
--source include/show_binlog_events.inc
21
# The point of this test is to make sure code is properly instrumented,
22
# where instruments have the proper key (binlog or relaylog),
23
# it is not to dive into statistics for each instruments.
24
# Different test execution sequence in different platforms do make the
25
# results vary, making the test results very sensitive to changes.
26
# To ensure robustness:
27
# - log file rotation is limited to file .000001 and .000002
28
# - statistics are normalized to "NONE" or "MANY"
29
# - statistics on ::update_cond conditions are not collected,
30
# since this is too much dependent on execution.
34
-- echo "============ Performance schema on master ============"
37
substring(file_name, locate("master-", file_name)) as FILE_NAME,
39
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
40
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
41
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
42
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
43
from performance_schema.file_summary_by_instance
44
where file_name like "%master-%" order by file_name;
46
select * from performance_schema.file_summary_by_instance
47
where file_name like "%slave-%" order by file_name;
49
-- echo "Expect a master binlog + binlog_index"
52
substring(file_name, locate("master-", file_name)) as FILE_NAME,
54
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
55
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
56
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
57
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
58
from performance_schema.file_summary_by_instance
59
where event_name like "%binlog%" order by file_name;
63
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
64
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
65
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
66
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
67
from performance_schema.file_summary_by_event_name
68
where event_name like "%binlog%" order by event_name;
72
if (count_star > 0, "MANY", "NONE") as COUNT_STAR
73
from performance_schema.events_waits_summary_global_by_event_name
74
where event_name like "%MYSQL_BIN_LOG%"
75
and event_name not like "%MYSQL_BIN_LOG::update_cond"
78
-- echo "Expect no slave relay log"
80
select * from performance_schema.file_summary_by_instance
81
where event_name like "%relaylog%" order by file_name;
83
select * from performance_schema.file_summary_by_event_name
84
where event_name like "%relaylog%" order by event_name;
86
select * from performance_schema.events_waits_summary_global_by_event_name
87
where event_name like "%MYSQL_RELAY_LOG%"
88
and event_name not like "%MYSQL_RELAY_LOG::update_cond"
91
sync_slave_with_master;
92
-- echo "============ Performance schema on slave ============"
94
select * from performance_schema.file_summary_by_instance
95
where file_name like "%master-%" order by file_name;
98
substring(file_name, locate("slave-", file_name)) as FILE_NAME,
100
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
101
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
102
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
103
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
104
from performance_schema.file_summary_by_instance
105
where file_name like "%slave-%"
106
and (file_name not like "%slave-relay-bin.0%"
107
or file_name like "%slave-relay-bin.000001"
108
or file_name like "%slave-relay-bin.000002")
111
-- echo "Expect a slave binlog + binlog_index"
114
substring(file_name, locate("slave-", file_name)) as FILE_NAME,
116
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
117
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
118
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
119
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
120
from performance_schema.file_summary_by_instance
121
where event_name like "%binlog%" order by file_name;
125
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
126
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
127
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
128
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
129
from performance_schema.file_summary_by_event_name
130
where event_name like "%binlog%" order by event_name;
134
if (count_star > 0, "MANY", "NONE") as COUNT_STAR
135
from performance_schema.events_waits_summary_global_by_event_name
136
where event_name like "%MYSQL_BIN_LOG%"
137
and event_name not like "%MYSQL_BIN_LOG::update_cond"
140
-- echo "Expect a slave relay log"
143
substring(file_name, locate("slave-", file_name)) as FILE_NAME,
145
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
146
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
147
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
148
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
149
from performance_schema.file_summary_by_instance
150
where event_name like "%relaylog%"
151
and (file_name not like "%slave-relay-bin.0%"
152
or file_name like "%slave-relay-bin.000001"
153
or file_name like "%slave-relay-bin.000002")
158
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
159
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
160
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
161
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
162
from performance_schema.file_summary_by_event_name
163
where event_name like "%relaylog%" order by event_name;
167
if (count_star > 0, "MANY", "NONE") as COUNT_STAR
168
from performance_schema.events_waits_summary_global_by_event_name
169
where event_name like "%MYSQL_RELAY_LOG%"
170
and event_name not like "%MYSQL_RELAY_LOG::update_cond"
173
--source include/stop_slave.inc