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/not_embedded.inc
5 --source include/have_perfschema.inc
6 --source include/master-slave.inc
7
8 --disable_warnings
9 drop table if exists test.t1;
10 --sync_slave_with_master
11 reset master;
12 --enable_warnings
13
14 create table test.t1(a int);
15 drop table test.t1;
16
17 --source include/show_binlog_events.inc
18
19 # Notes
20 #
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.
31 # - statistics on COND_binlog_background_thread and COND_xid_list are not
32 # collected, as they depend on exact timing for background binlog
33 # checkpointing operations.
34 #
35
36 connection master;
37
38 select
39 substring(file_name, locate("master-", file_name)) as FILE_NAME,
40 EVENT_NAME,
41 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
42 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
43 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
44 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
45 from performance_schema.file_summary_by_instance
46 where file_name like "%master-%" and file_name not like "%sql/share%" order by file_name;
47
48 select * from performance_schema.file_summary_by_instance
49 where file_name like "%slave-%" order by file_name;
50
51 -- echo "Expect a master binlog + binlog_index"
52
53 select
54 substring(file_name, locate("master-", file_name)) as FILE_NAME,
55 EVENT_NAME,
56 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
57 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
58 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
59 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
60 from performance_schema.file_summary_by_instance
61 where event_name like "%binlog%" order by file_name;
62
63 select
64 EVENT_NAME,
65 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
66 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
67 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
68 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
69 from performance_schema.file_summary_by_event_name
70 where event_name like "%binlog%" order by event_name;
71
72 select
73 EVENT_NAME,
74 if (count_star > 0, "MANY", "NONE") as COUNT_STAR
75 from performance_schema.events_waits_summary_global_by_event_name
76 where event_name like "%MYSQL_BIN_LOG%"
77 and event_name not like "%MYSQL_BIN_LOG::update_cond"
78 and event_name not like "%MYSQL_BIN_LOG::COND_binlog_background_thread%"
79 and event_name not like "%MYSQL_BIN_LOG::COND_xid_list"
80 order by event_name;
81
82 -- echo "Expect no slave relay log"
83
84 select * from performance_schema.file_summary_by_instance
85 where event_name like "%relaylog%" order by file_name;
86
87 select * from performance_schema.file_summary_by_event_name
88 where event_name like "%relaylog%" order by event_name;
89
90 select * 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 and event_name not like "%MYSQL_BIN_LOG::COND_binlog_background_thread%"
143 and event_name not like "%MYSQL_BIN_LOG::COND_xid_list"
144 order by event_name;
145
146 -- echo "Expect a slave relay log"
147
148 select
149 substring(file_name, locate("slave-", file_name)) as FILE_NAME,
150 EVENT_NAME,
151 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
152 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
153 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
154 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
155 from performance_schema.file_summary_by_instance
156 where event_name like "%relaylog%"
157 and (file_name not like "%slave-relay-bin.0%"
158 or file_name like "%slave-relay-bin.000001"
159 or file_name like "%slave-relay-bin.000002")
160 order by file_name;
161
162 select
163 EVENT_NAME,
164 if (count_read > 0, "MANY", "NONE") as COUNT_READ,
165 if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
166 if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
167 if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
168 from performance_schema.file_summary_by_event_name
169 where event_name like "%relaylog%" order by event_name;
170
171 select
172 EVENT_NAME,
173 if (count_star > 0, "MANY", "NONE") as COUNT_STAR
174 from performance_schema.events_waits_summary_global_by_event_name
175 where event_name like "%MYSQL_RELAY_LOG%"
176 and event_name not like "%MYSQL_RELAY_LOG::update_cond"
177 order by event_name;
178
179 --source include/stop_slave.inc
180