Debian Codegraph @

mysql-test/suite/perfschema/t/relaylog.test

raw
1 # Tests for PERFORMANCE_SCHEMA
2
3 --source include/have_log_bin.inc
4 --source include/master-slave.inc
5
6 --disable_warnings
7 drop table if exists test.t1;
8 --sync_slave_with_master
9 reset master;
10 --enable_warnings
11
12 create table test.t1(a int);
13 drop table test.t1;
14
15 --source include/show_binlog_events.inc
16
17 # Notes
18 #
19 # The point of this test is to make sure code is properly instrumented,
20 # where instruments have the proper key (binlog or relaylog),
21 # it is not to dive into statistics for each instruments.
22 # Different test execution sequence in different platforms do make the
23 # results vary, making the test results very sensitive to changes.
24 # To ensure robustness:
25 # - log file rotation is limited to file .000001 and .000002
26 # - statistics are normalized to "NONE" or "MANY"
27 # - statistics on ::update_cond conditions are not collected,
28 # since this is too much dependent on execution.
29 #
30
31 connection master;
32 -- echo "============ Performance schema on master ============"
33
34 select
35 substring(file_name, locate("master-", file_name)) as FILE_NAME,
36 EVENT_NAME,
37 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
38 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
39 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
40 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
41 from performance_schema.file_summary_by_instance
42 where file_name like "%master-%" order by file_name;
43
44 select * from performance_schema.file_summary_by_instance
45 where file_name like "%slave-%" order by file_name;
46
47 -- echo "Expect a master binlog + binlog_index"
48
49 select
50 substring(file_name, locate("master-", file_name)) as FILE_NAME,
51 EVENT_NAME,
52 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
53 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
54 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
55 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
56 from performance_schema.file_summary_by_instance
57 where event_name like "%binlog%" order by file_name;
58
59 select
60 EVENT_NAME,
61 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
62 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
63 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
64 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
65 from performance_schema.file_summary_by_event_name
66 where event_name like "%binlog%" order by event_name;
67
68 select
69 EVENT_NAME,
70 if (count_star > 0, "MANY", "NONE") as COUNT_STAR
71 from performance_schema.events_waits_summary_global_by_event_name
72 where event_name like "%MYSQL_BIN_LOG%"
73 and event_name not like "%MYSQL_BIN_LOG::update_cond"
74 order by event_name;
75
76 -- echo "Expect no slave relay log"
77
78 select * from performance_schema.file_summary_by_instance
79 where event_name like "%relaylog%" order by file_name;
80
81 select * from performance_schema.file_summary_by_event_name
82 where event_name like "%relaylog%" order by event_name;
83
84 select EVENT_NAME,
85 if (count_star > 0, "MANY", "NONE") as COUNT_STAR,
86 if (sum_timer_wait > 0, "MANY", "NONE") as SUM_TIMER_WAIT,
87 if (min_timer_wait > 0, "MANY", "NONE") as MIN_TIMER_WAIT,
88 if (avg_timer_wait > 0, "MANY", "NONE") as AVG_TIMER_WAIT,
89 if (max_timer_wait > 0, "MANY", "NONE") as MAX_TIMER_WAIT
90 from performance_schema.events_waits_summary_global_by_event_name
91 where event_name like "%MYSQL_RELAY_LOG%"
92 and event_name not like "%MYSQL_RELAY_LOG::update_cond"
93 order by event_name;
94
95 sync_slave_with_master;
96 -- echo "============ Performance schema on slave ============"
97
98 select * from performance_schema.file_summary_by_instance
99 where file_name like "%master-%" order by file_name;
100
101 select
102 substring(file_name, locate("slave-", file_name)) as FILE_NAME,
103 EVENT_NAME,
104 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
105 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
106 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
107 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
108 from performance_schema.file_summary_by_instance
109 where file_name like "%slave-%"
110 and (file_name not like "%slave-relay-bin.0%"
111 or file_name like "%slave-relay-bin.000001"
112 or file_name like "%slave-relay-bin.000002")
113 order by file_name;
114
115 -- echo "Expect a slave binlog + binlog_index"
116
117 select
118 substring(file_name, locate("slave-", file_name)) as FILE_NAME,
119 EVENT_NAME,
120 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
121 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
122 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
123 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
124 from performance_schema.file_summary_by_instance
125 where event_name like "%binlog%" order by file_name;
126
127 select
128 EVENT_NAME,
129 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
130 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
131 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
132 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
133 from performance_schema.file_summary_by_event_name
134 where event_name like "%binlog%" order by event_name;
135
136 select
137 EVENT_NAME,
138 if (count_star > 0, "MANY", "NONE") as COUNT_STAR
139 from performance_schema.events_waits_summary_global_by_event_name
140 where event_name like "%MYSQL_BIN_LOG%"
141 and event_name not like "%MYSQL_BIN_LOG::update_cond"
142 order by event_name;
143
144 -- echo "Expect a slave relay log"
145
146 select
147 substring(file_name, locate("slave-", file_name)) as FILE_NAME,
148 EVENT_NAME,
149 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
150 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
151 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
152 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
153 from performance_schema.file_summary_by_instance
154 where event_name like "%relaylog%"
155 and (file_name not like "%slave-relay-bin.0%"
156 or file_name like "%slave-relay-bin.000001"
157 or file_name like "%slave-relay-bin.000002")
158 order by file_name;
159
160 select
161 EVENT_NAME,
162 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
163 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
164 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
165 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
166 from performance_schema.file_summary_by_event_name
167 where event_name like "%relaylog%" order by event_name;
168
169 select
170 EVENT_NAME,
171 if (count_star > 0, "MANY", "NONE") as COUNT_STAR
172 from performance_schema.events_waits_summary_global_by_event_name
173 where event_name like "%MYSQL_RELAY_LOG%"
174 and event_name not like "%MYSQL_RELAY_LOG::update_cond"
175 order by event_name;
176
177 --source include/rpl_end.inc
178