File: rpl_perfschema_connect_config.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (317 lines) | stat: -rw-r--r-- 15,164 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# ==== Purpose ====
#
# This test script serves as the functionality testing for the table
# performance_schema.replication_connection_configuration. Test for ddl and dml
# operations is a part of the perfschema suite. The ddl/dml tests are named:
# 1) ddl_replication_connection_configuration.test and
# 2) dml_replication_connection_configuration.test.
#
# This test script does the following:

#  - On master, the table returns an empty set.
#  - We perform all other testing on connection "slave". So, the below points
#    are checked on slave only.
#  - Verify that SELECT works for every field in the table.
#  - The SELECT per field produces an output similar to the corresponding field
#    in SHOW SLAVE STATUS(SSS), if there is one.
#  - If there is no matching field in SSS, we resort to other method of testing
#    those fields.
#
# The follwing scenarios are tested:
#
#  - Test each field on a fresh replication setup.
#  - Change configuration parameters using CHANGE MASTER TO and verify that
#    these changes are seen in SELECTs from PS table.
#  - Verify that, the change in values are correctly shown by the table.
#  - Start server with gtid-mode=on and test the AUTO_POSITION field.
#
#  ==== Related Worklog ====
#
#  WL#3656: PERFORMANCE SCHEMA table for SHOW SLAVE STATUS
#  Bug#18174719: P_S.REPLICATION_CONNECTION_CONFIGURATION'S COL
#                SSL_CRL_PATH THROWS WARNING 1366
#  WL#7817: RPL Monitoring: Move status variables to replication P_S tables
#           for multi-source monitoring

--let $rpl_privilege_checks_user_grant_option = 1
--source include/set_privilege_checks_user_as_system_user.inc
source include/master-slave.inc;
source include/have_binlog_format_mixed.inc;

call mtr.add_suppression("Source command COM_REGISTER_REPLICA failed.");
# This warning supression is added here to  avoid the test failing
# due to Bug#16580366. The warning supression can be removed after
# the bug is fixed.
call mtr.add_suppression(" * does not exist in the InnoDB internal");

let $assert_text= On master, the table should return an empty set.;
let $assert_cond= [select count(*) from performance_schema.replication_connection_configuration] = 0;
source include/assert.inc;

--connection slave

--echo
--echo # Verify that SELECT works for every field and produces an output
--echo # similar to the corresponding field in SHOW SLAVE STATUS(SSS).
--echo

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $ps_value= query_get_value(select Host from performance_schema.replication_connection_configuration, Host, 1);
let $assert_text= Value returned by SSS and PS table for Host should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Port, 1);
let $ps_value= query_get_value(select Port from performance_schema.replication_connection_configuration, Port, 1);
let $assert_text= Value returned by SSS and PS table for Port should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
let $ps_value= query_get_value(select User from performance_schema.replication_connection_configuration, User, 1);
let $assert_text= Value returned by SSS and PS table for User should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Bind, 1);
let $ps_value= query_get_value(select Network_Interface from performance_schema.replication_connection_configuration, Network_Interface, 1);
let $assert_text= Value returned by SSS and PS table for Network_Interface should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Auto_Position, 1);
let $ps_value= query_get_value(select Auto_Position from performance_schema.replication_connection_configuration, Auto_Position, 1);
let $assert_text= Value returned by SSS and PS table for Auto_Position should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1);
let $ps_value= query_get_value(select SSL_Allowed from performance_schema.replication_connection_configuration, SSL_Allowed, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Allowed should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_File, 1);
let $ps_value= query_get_value(select SSL_CA_File from performance_schema.replication_connection_configuration, SSL_CA_File, 1);
let $assert_text= Value returned by SSS and PS table for SSL_CA_File should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_Path, 1);
let $ps_value= query_get_value(select SSL_CA_Path from performance_schema.replication_connection_configuration, SSL_CA_Path, 1);
let $assert_text= Value returned by SSS and PS table for SSL_CA_Path should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cert, 1);
let $ps_value= query_get_value(select SSL_Certificate from performance_schema.replication_connection_configuration, SSL_Certificate, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Certificate should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cipher, 1);
let $ps_value= query_get_value(select SSL_Cipher from performance_schema.replication_connection_configuration, SSL_Cipher, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Cipher should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Key, 1);
let $ps_value= query_get_value(select SSL_Key from performance_schema.replication_connection_configuration, SSL_Key, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Key should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1);
let $ps_value= query_get_value(select SSL_Verify_Server_Certificate from performance_schema.replication_connection_configuration, SSL_Verify_Server_Certificate, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crl, 1);
let $ps_value= query_get_value(select SSL_Crl_File from performance_schema.replication_connection_configuration, SSL_Crl_File, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Crl_File should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crlpath, 1);
let $ps_value= query_get_value(select SSL_Crl_Path from performance_schema.replication_connection_configuration, SSL_Crl_Path, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Crl_Path should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Connect_Retry, 1);
let $ps_value= query_get_value(select Connection_Retry_Interval from performance_schema.replication_connection_configuration, Connection_Retry_Interval, 1);
let $assert_text= Value returned by SSS and PS table for Connection_Retry_Interval should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1);
let $ps_value= query_get_value(select Connection_Retry_Count from performance_schema.replication_connection_configuration, Connection_Retry_Count, 1);
let $assert_text= Value returned by SSS and PS table for Connection_Retry_Count should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

--echo
--echo # Change configuration parameters and verify that these changes
--echo # are shown correctly by SELECTs from PS table.
--echo

# create a user for replication that requires ssl encryption
--connection master
create user replssl@localhost require ssl;
grant replication slave on *.* to replssl@localhost;
--source include/sync_slave_sql_with_master.inc

# Setup slave to use SSL for connection to master
--source include/stop_slave.inc
replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR;
replace_column 2 ####;
eval CHANGE REPLICATION SOURCE to
  SOURCE_USER= 'replssl',
  SOURCE_PASSWORD= '',
  SOURCE_RETRY_COUNT= 1,
  SOURCE_SSL= 1,
  SOURCE_SSL_CA= '$MYSQL_TEST_DIR/std_data/cacert.pem',
  SOURCE_SSL_CERT= '$MYSQL_TEST_DIR/std_data/client-cert.pem',
  SOURCE_SSL_KEY= '$MYSQL_TEST_DIR/std_data/client-key.pem';

--echo
--echo # Checking SSL parameters, they were empty in tests done in the
--echo # previous section.
--echo

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1);
let $ps_value= query_get_value(select SSL_Allowed from performance_schema.replication_connection_configuration, SSL_Allowed, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Allowed should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_File, 1);
let $ps_value= query_get_value(select SSL_CA_File from performance_schema.replication_connection_configuration, SSL_CA_File, 1);
let $assert_text= Value returned by SSS and PS table for SSL_CA_File should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_Path, 1);
let $ps_value= query_get_value(select SSL_CA_Path from performance_schema.replication_connection_configuration, SSL_CA_Path, 1);
let $assert_text= Value returned by SSS and PS table for SSL_CA_Path should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cert, 1);
let $ps_value= query_get_value(select SSL_Certificate from performance_schema.replication_connection_configuration, SSL_Certificate, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Certificate should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cipher, 1);
let $ps_value= query_get_value(select SSL_Cipher from performance_schema.replication_connection_configuration, SSL_Cipher, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Cipher should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Key, 1);
let $ps_value= query_get_value(select SSL_Key from performance_schema.replication_connection_configuration, SSL_Key, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Key should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1);
let $ps_value= query_get_value(select SSL_Verify_Server_Certificate from performance_schema.replication_connection_configuration, SSL_Verify_Server_Certificate, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

# We cannot set master_ssl=1 when both ssl_crl and ssl_crlpath are used in
# CHANGE MASTER. (See bug#18165937)
CHANGE REPLICATION SOURCE to SOURCE_SSL=0;
replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR;
replace_column 2 ####;
eval CHANGE REPLICATION SOURCE to SOURCE_SSL_CRL= '$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl', SOURCE_SSL_CRLPATH= '$MYSQL_TEST_DIR/std_data/crldir';

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crl, 1);
let $ps_value= query_get_value(select SSL_Crl_File from performance_schema.replication_connection_configuration, SSL_Crl_File, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Crl_File should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crlpath, 1);
let $ps_value= query_get_value(select SSL_Crl_Path from performance_schema.replication_connection_configuration, SSL_Crl_Path, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Crl_Path should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_TLS_Version, 1);
let $ps_value= query_get_value(select Tls_Version from performance_schema.replication_connection_configuration, Tls_Version, 1);
let $assert_text= Value returned by SSS and PS table for TLS version should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

--echo
--echo # Test with servers in gtid-mode=on.
--echo

let $rpl_server_number= 1;
let $rpl_start_with_gtids= 1;
source include/rpl_restart_server.inc;

let $rpl_server_number= 2;
let $rpl_start_with_gtids= 1;
source include/rpl_restart_server.inc;

--connection slave

--echo
--echo # 1) Test for Auto_position= 0.
--echo

let $sss_value= query_get_value(SHOW SLAVE STATUS, Auto_Position, 1);
let $ps_value= query_get_value(select Auto_Position from performance_schema.replication_connection_configuration, Auto_Position, 1);
let $assert_text= Value returned by SSS and PS table for Auto_Position should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

replace_column 2 ####;
CHANGE REPLICATION SOURCE to
 SOURCE_USER = 'root',
 SOURCE_AUTO_POSITION= 1;

--echo
--echo # 2) Test for Auto_position= 1.
--echo

let $sss_value= query_get_value(SHOW SLAVE STATUS, Auto_Position, 1);
let $ps_value= query_get_value(select Auto_Position from performance_schema.replication_connection_configuration, Auto_Position, 1);
let $assert_text= Value returned by SSS and PS table for Auto_Position should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;

let $rpl_only_running_threads= 1;

# Cleanup
--connection slave
replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR;
replace_column 2 ####;
eval CHANGE REPLICATION SOURCE to
  SOURCE_AUTO_POSITION= 0,
  SOURCE_SSL_CRL= '',
  SOURCE_SSL_CRLPATH= '',
  SOURCE_SSL_CA= '',
  SOURCE_SSL_CERT= '',
  SOURCE_SSL_KEY='';

# Reset the gtid mode if the test started with gtid_mode=OFF
--if ($gtid_mode_on == 0) {
 --let $rpl_gtid_mode = 0
 --let $rpl_set_enforce_gtid_consistency= 0
}
--let $no_extra_info= 1
--source include/rpl_set_gtid_mode.inc


--connection master
drop user replssl@localhost;
--connection slave
drop user replssl@localhost;

source include/rpl_end.inc;