Debian Codegraph @

mysql-test/suite/rpl/t/rpl_perfschema_connect_config.test

raw
1 # ==== Purpose ====
2 #
3 # This test script serves as the functionality testing for the table
4 # performance_schema.replication_connection_configuration. Test for ddl and dml
5 # operations is a part of the perfschema suite. The ddl/dml tests are named:
6 # 1) ddl_replication_connection_configuration.test and
7 # 2) dml_replication_connection_configuration.test.
8 #
9 # This test script does the following:
10
11 # - On master, the table returns an empty set.
12 # - We perform all other testing on connection "slave". So, the below points
13 # are checked on slave only.
14 # - Verify that SELECT works for every field in the table.
15 # - The SELECT per field produces an output similar to the corresponding field
16 # in SHOW SLAVE STATUS(SSS), if there is one.
17 # - If there is no matching field in SSS, we resort to other method of testing
18 # those fields.
19 #
20 # The follwing scenarios are tested:
21 #
22 # - Test each field on a fresh replication setup.
23 # - Change configuration parameters using CHANGE MASTER TO and verify that
24 # these changes are seen in SELECTs from PS table.
25 # - Verify that, the change in values are correctly shown by the table.
26 # - Verify different values for MASTER_USE_GTID are present in table.
27 # - Verify IGNORE_SERVER_IDS, DO_DOMAIN_IDS and IGNORE_DOMAIN_IDS
28 #
29 # ==== Related Worklog ====
30 #
31 # MDEV-16437: merge 5.7 P_S replication instrumentation and tables
32 #
33
34 source include/have_ssl_communication.inc;
35 source include/have_binlog_format_mixed.inc;
36 source include/have_perfschema.inc;
37 source include/master-slave.inc;
38
39 --let $assert_text= On master, the table should return an empty set.
40 --let $assert_cond= count(*) = 0 from performance_schema.replication_connection_configuration
41 --source include/rpl_assert.inc
42
43 --connection slave
44
45 --echo
46 --echo # Verify that SELECT works for every field and produces an output
47 --echo # similar to the corresponding field in SHOW SLAVE STATUS(SSS).
48 --echo
49
50 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
51 let $ps_value= query_get_value(select Host from performance_schema.replication_connection_configuration, Host, 1);
52 let $assert_text= Value returned by SSS and PS table for Host should be same.;
53 let $assert_cond= "$sss_value" = "$ps_value";
54 source include/assert.inc;
55
56 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Port, 1);
57 let $ps_value= query_get_value(select Port from performance_schema.replication_connection_configuration, Port, 1);
58 let $assert_text= Value returned by SSS and PS table for Port should be same.;
59 let $assert_cond= "$sss_value" = "$ps_value";
60 source include/assert.inc;
61
62 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
63 let $ps_value= query_get_value(select User from performance_schema.replication_connection_configuration, User, 1);
64 let $assert_text= Value returned by SSS and PS table for User should be same.;
65 let $assert_cond= "$sss_value" = "$ps_value";
66 source include/assert.inc;
67
68 let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
69 let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
70 let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
71 let $assert_cond= "$sss_value" = "$ps_value";
72 source include/assert.inc;
73
74 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1);
75 let $ps_value= query_get_value(select SSL_Allowed from performance_schema.replication_connection_configuration, SSL_Allowed, 1);
76 let $assert_text= Value returned by SSS and PS table for SSL_Allowed should be same.;
77 let $assert_cond= "$sss_value" = "$ps_value";
78 source include/assert.inc;
79
80 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_File, 1);
81 let $ps_value= query_get_value(select SSL_CA_File from performance_schema.replication_connection_configuration, SSL_CA_File, 1);
82 let $assert_text= Value returned by SSS and PS table for SSL_CA_File should be same.;
83 let $assert_cond= "$sss_value" = "$ps_value";
84 source include/assert.inc;
85
86 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_Path, 1);
87 let $ps_value= query_get_value(select SSL_CA_Path from performance_schema.replication_connection_configuration, SSL_CA_Path, 1);
88 let $assert_text= Value returned by SSS and PS table for SSL_CA_Path should be same.;
89 let $assert_cond= "$sss_value" = "$ps_value";
90 source include/assert.inc;
91
92 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cert, 1);
93 let $ps_value= query_get_value(select SSL_Certificate from performance_schema.replication_connection_configuration, SSL_Certificate, 1);
94 let $assert_text= Value returned by SSS and PS table for SSL_Certificate should be same.;
95 let $assert_cond= "$sss_value" = "$ps_value";
96 source include/assert.inc;
97
98 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cipher, 1);
99 let $ps_value= query_get_value(select SSL_Cipher from performance_schema.replication_connection_configuration, SSL_Cipher, 1);
100 let $assert_text= Value returned by SSS and PS table for SSL_Cipher should be same.;
101 let $assert_cond= "$sss_value" = "$ps_value";
102 source include/assert.inc;
103
104 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Key, 1);
105 let $ps_value= query_get_value(select SSL_Key from performance_schema.replication_connection_configuration, SSL_Key, 1);
106 let $assert_text= Value returned by SSS and PS table for SSL_Key should be same.;
107 let $assert_cond= "$sss_value" = "$ps_value";
108 source include/assert.inc;
109
110 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1);
111 let $ps_value= query_get_value(select SSL_Verify_Server_Certificate from performance_schema.replication_connection_configuration, SSL_Verify_Server_Certificate, 1);
112 let $assert_text= Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.;
113 let $assert_cond= "$sss_value" = "$ps_value";
114 source include/assert.inc;
115
116 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crl, 1);
117 let $ps_value= query_get_value(select SSL_Crl_File from performance_schema.replication_connection_configuration, SSL_Crl_File, 1);
118 let $assert_text= Value returned by SSS and PS table for SSL_Crl_File should be same.;
119 let $assert_cond= "$sss_value" = "$ps_value";
120 source include/assert.inc;
121
122 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crlpath, 1);
123 let $ps_value= query_get_value(select SSL_Crl_Path from performance_schema.replication_connection_configuration, SSL_Crl_Path, 1);
124 let $assert_text= Value returned by SSS and PS table for SSL_Crl_Path should be same.;
125 let $assert_cond= "$sss_value" = "$ps_value";
126 source include/assert.inc;
127
128 let $sss_value= query_get_value(SHOW SLAVE STATUS, Connect_Retry, 1);
129 let $ps_value= query_get_value(select Connection_Retry_Interval from performance_schema.replication_connection_configuration, Connection_Retry_Interval, 1);
130 let $assert_text= Value returned by SSS and PS table for Connection_Retry_Interval should be same.;
131 let $assert_cond= "$sss_value" = "$ps_value";
132 source include/assert.inc;
133
134 let $ps_value= query_get_value(select Connection_Retry_Count from performance_schema.replication_connection_configuration, Connection_Retry_Count, 1);
135 let $assert_text= Value returned by PS table for Connection_Retry_Count should be 10.; # master-retry-count=10, as part of default my.cnf used by MTR
136 let $assert_cond= "$ps_value" = 10;
137 source include/assert.inc;
138
139 --echo
140 --echo # Heartbeat_Interval is part of I_S and P_S. We will compare the
141 --echo # two to make sure both match.
142 --echo
143
144 let $is_value= query_get_value(select Variable_Value from information_schema.GLOBAL_STATUS where variable_name= 'Slave_heartbeat_period', Variable_Value, 1);
145 let $ps_value= query_get_value(select Heartbeat_Interval from performance_schema.replication_connection_configuration, Heartbeat_Interval, 1);
146 let $assert_text= Value returned by IS and PS table for Heartbeat_Interval should be same.;
147 let $assert_cond= $is_value = $ps_value;
148 source include/assert.inc;
149
150 --echo
151 --echo # Change configuration parameters and verify that these changes
152 --echo # are shown correctly by SELECTs from PS table.
153 --echo
154
155 # create a user for replication that requires ssl encryption
156 --connection master
157 create user replssl@localhost;
158 grant replication slave on *.* to replssl@localhost require ssl;
159 --source include/sync_slave_sql_with_master.inc
160
161 # Setup slave to use SSL for connection to master
162 --source include/stop_slave.inc
163 replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR;
164 eval change master to
165 master_user= 'replssl',
166 master_password= '',
167 master_ssl= 1,
168 master_ssl_ca= '$MYSQL_TEST_DIR/std_data/cacert.pem',
169 master_ssl_cert= '$MYSQL_TEST_DIR/std_data/client-cert.pem',
170 master_ssl_key= '$MYSQL_TEST_DIR/std_data/client-key.pem';
171 --source include/start_slave.inc
172
173 --connection slave
174 --echo
175 --echo # Checking SSL parameters, they were empty in tests done in the
176 --echo # previous section.
177 --echo
178
179 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1);
180 let $ps_value= query_get_value(select SSL_Allowed from performance_schema.replication_connection_configuration, SSL_Allowed, 1);
181 let $assert_text= Value returned by SSS and PS table for SSL_Allowed should be same.;
182 let $assert_cond= "$sss_value" = "$ps_value";
183 source include/assert.inc;
184
185 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_File, 1);
186 let $ps_value= query_get_value(select SSL_CA_File from performance_schema.replication_connection_configuration, SSL_CA_File, 1);
187 let $assert_text= Value returned by SSS and PS table for SSL_CA_File should be same.;
188 let $assert_cond= "$sss_value" = "$ps_value";
189 source include/assert.inc;
190
191 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_Path, 1);
192 let $ps_value= query_get_value(select SSL_CA_Path from performance_schema.replication_connection_configuration, SSL_CA_Path, 1);
193 let $assert_text= Value returned by SSS and PS table for SSL_CA_Path should be same.;
194 let $assert_cond= "$sss_value" = "$ps_value";
195 source include/assert.inc;
196
197 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cert, 1);
198 let $ps_value= query_get_value(select SSL_Certificate from performance_schema.replication_connection_configuration, SSL_Certificate, 1);
199 let $assert_text= Value returned by SSS and PS table for SSL_Certificate should be same.;
200 let $assert_cond= "$sss_value" = "$ps_value";
201 source include/assert.inc;
202
203 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cipher, 1);
204 let $ps_value= query_get_value(select SSL_Cipher from performance_schema.replication_connection_configuration, SSL_Cipher, 1);
205 let $assert_text= Value returned by SSS and PS table for SSL_Cipher should be same.;
206 let $assert_cond= "$sss_value" = "$ps_value";
207 source include/assert.inc;
208
209 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Key, 1);
210 let $ps_value= query_get_value(select SSL_Key from performance_schema.replication_connection_configuration, SSL_Key, 1);
211 let $assert_text= Value returned by SSS and PS table for SSL_Key should be same.;
212 let $assert_cond= "$sss_value" = "$ps_value";
213 source include/assert.inc;
214
215 let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1);
216 let $ps_value= query_get_value(select SSL_Verify_Server_Certificate from performance_schema.replication_connection_configuration, SSL_Verify_Server_Certificate, 1);
217 let $assert_text= Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.;
218 let $assert_cond= "$sss_value" = "$ps_value";
219 source include/assert.inc;
220
221 --connection master
222 drop user replssl@localhost;
223 --sync_slave_with_master
224 --source include/stop_slave.inc
225
226 CHANGE MASTER TO
227 master_host= '127.0.0.1',
228 master_user= 'root',
229 master_password= '',
230 master_ssl_ca= '',
231 master_ssl_cert= '',
232 master_ssl_key= '',
233 master_ssl_verify_server_cert=0,
234 master_ssl=1,
235 master_use_gtid=no;
236 --source include/start_slave.inc
237
238 --echo
239 --echo # Test with different MASTER_USE_GTID values
240 --echo
241
242 --echo
243 --echo # 1) Test for MASTER_USE_GTID=NO
244 --echo
245 --source include/stop_slave.inc
246 change master to
247 master_user = 'root',
248 master_use_gtid = NO;
249
250 let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
251 let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
252 let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
253 let $assert_cond= "$sss_value" = "$ps_value";
254 source include/assert.inc;
255
256 --echo
257 --echo # 2) Test for Auto_position= CURRENT_POS.
258 --echo
259 change master to
260 master_user = 'root',
261 master_use_gtid= CURRENT_POS;
262
263 let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
264 let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
265 let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
266 let $assert_cond= "$sss_value" = "$ps_value";
267 source include/assert.inc;
268
269 --echo
270 --echo # 3) Test for Auto_position= SLAVE_POS
271 --echo
272 change master to
273 master_user = 'root',
274 master_use_gtid= SLAVE_POS;
275 let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
276 let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
277 let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
278 let $assert_cond= "$sss_value" = "$ps_value";
279 source include/assert.inc;
280
281 --echo
282 --echo # Test INOGRE_SERVER_IDS
283 --echo
284
285 --echo
286 --echo # 1) Test for IGNORE_SERVER_IDS= (10, 100);
287 --echo
288
289 --connection slave
290 change master to IGNORE_SERVER_IDS= (10, 100);
291 let $sss_value= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
292 let $ps_value= query_get_value(select Ignore_Server_Ids from performance_schema.replication_connection_configuration, Ignore_Server_Ids, 1);
293 let $assert_text= Value returned by SSS and PS table for Ignore_server_ids should be same.;
294 let $assert_cond= "$sss_value" = "$ps_value";
295 source include/assert.inc;
296 CHANGE MASTER TO IGNORE_SERVER_IDS=();
297
298 --echo
299 --echo # 2) Test for IGNORE_DOMAIN_IDS(2)
300 --echo
301
302 CHANGE MASTER TO IGNORE_DOMAIN_IDS=(2), MASTER_USE_GTID=slave_pos;
303 --source include/start_slave.inc
304 let $sss_value= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
305 let $ps_value= query_get_value(select Repl_Ignore_Domain_Ids from performance_schema.replication_connection_configuration, Repl_Ignore_Domain_Ids, 1);
306 let $assert_text= Value returned by SSS and PS table for Replicate_Ignore_Domain_Ids should be same.;
307 let $assert_cond= "$sss_value" = "$ps_value";
308 source include/assert.inc;
309 --source include/stop_slave.inc
310
311 --echo
312 --echo # 3) Test for DO_DOMAIN_IDS(1)
313 --echo
314
315 CHANGE MASTER TO DO_DOMAIN_IDS=(1), IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
316 --source include/start_slave.inc
317 let $sss_value= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
318 let $ps_value= query_get_value(select Repl_Do_Domain_Ids from performance_schema.replication_connection_configuration, Repl_Do_Domain_Ids, 1);
319 let $assert_text= Value returned by SSS and PS table for Replicate_Do_Domain_Ids should be same.;
320 let $assert_cond= "$sss_value" = "$ps_value";
321 source include/assert.inc;
322 --source include/stop_slave.inc
323
324 CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=();
325 --source include/start_slave.inc
326
327 source include/rpl_end.inc;