| 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 |
# - Start server with gtid-mode=on and test the AUTO_POSITION field. |
| 27 |
# |
| 28 |
# ==== Related Worklog ==== |
| 29 |
# |
| 30 |
# WL#3656: PERFORMANCE SCHEMA table for SHOW SLAVE STATUS |
| 31 |
# Bug#18174719: P_S.REPLICATION_CONNECTION_CONFIGURATION'S COL |
| 32 |
# SSL_CRL_PATH THROWS WARNING 1366 |
| 33 |
# WL#7817: RPL Monitoring: Move status variables to replication P_S tables |
| 34 |
# for multi-source monitoring |
| 35 |
|
| 36 |
--let $rpl_privilege_checks_user_grant_option = 1 |
| 37 |
--source include/set_privilege_checks_user_as_system_user.inc |
| 38 |
source include/master-slave.inc; |
| 39 |
source include/have_binlog_format_mixed.inc; |
| 40 |
|
| 41 |
call mtr.add_suppression("Source command COM_REGISTER_REPLICA failed."); |
| 42 |
# This warning supression is added here to avoid the test failing |
| 43 |
# due to Bug#16580366. The warning supression can be removed after |
| 44 |
# the bug is fixed. |
| 45 |
call mtr.add_suppression(" * does not exist in the InnoDB internal"); |
| 46 |
|
| 47 |
let $assert_text= On master, the table should return an empty set.; |
| 48 |
let $assert_cond= [select count(*) from performance_schema.replication_connection_configuration] = 0; |
| 49 |
source include/assert.inc; |
| 50 |
|
| 51 |
--connection slave |
| 52 |
|
| 53 |
--echo |
| 54 |
--echo # Verify that SELECT works for every field and produces an output |
| 55 |
--echo # similar to the corresponding field in SHOW SLAVE STATUS(SSS). |
| 56 |
--echo |
| 57 |
|
| 58 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); |
| 59 |
let $ps_value= query_get_value(select Host from performance_schema.replication_connection_configuration, Host, 1); |
| 60 |
let $assert_text= Value returned by SSS and PS table for Host should be same.; |
| 61 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 62 |
source include/assert.inc; |
| 63 |
|
| 64 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Port, 1); |
| 65 |
let $ps_value= query_get_value(select Port from performance_schema.replication_connection_configuration, Port, 1); |
| 66 |
let $assert_text= Value returned by SSS and PS table for Port should be same.; |
| 67 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 68 |
source include/assert.inc; |
| 69 |
|
| 70 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_User, 1); |
| 71 |
let $ps_value= query_get_value(select User from performance_schema.replication_connection_configuration, User, 1); |
| 72 |
let $assert_text= Value returned by SSS and PS table for User should be same.; |
| 73 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 74 |
source include/assert.inc; |
| 75 |
|
| 76 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Bind, 1); |
| 77 |
let $ps_value= query_get_value(select Network_Interface from performance_schema.replication_connection_configuration, Network_Interface, 1); |
| 78 |
let $assert_text= Value returned by SSS and PS table for Network_Interface should be same.; |
| 79 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 80 |
source include/assert.inc; |
| 81 |
|
| 82 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Auto_Position, 1); |
| 83 |
let $ps_value= query_get_value(select Auto_Position from performance_schema.replication_connection_configuration, Auto_Position, 1); |
| 84 |
let $assert_text= Value returned by SSS and PS table for Auto_Position should be same.; |
| 85 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 86 |
source include/assert.inc; |
| 87 |
|
| 88 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1); |
| 89 |
let $ps_value= query_get_value(select SSL_Allowed from performance_schema.replication_connection_configuration, SSL_Allowed, 1); |
| 90 |
let $assert_text= Value returned by SSS and PS table for SSL_Allowed should be same.; |
| 91 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 92 |
source include/assert.inc; |
| 93 |
|
| 94 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_File, 1); |
| 95 |
let $ps_value= query_get_value(select SSL_CA_File from performance_schema.replication_connection_configuration, SSL_CA_File, 1); |
| 96 |
let $assert_text= Value returned by SSS and PS table for SSL_CA_File should be same.; |
| 97 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 98 |
source include/assert.inc; |
| 99 |
|
| 100 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_Path, 1); |
| 101 |
let $ps_value= query_get_value(select SSL_CA_Path from performance_schema.replication_connection_configuration, SSL_CA_Path, 1); |
| 102 |
let $assert_text= Value returned by SSS and PS table for SSL_CA_Path should be same.; |
| 103 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 104 |
source include/assert.inc; |
| 105 |
|
| 106 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cert, 1); |
| 107 |
let $ps_value= query_get_value(select SSL_Certificate from performance_schema.replication_connection_configuration, SSL_Certificate, 1); |
| 108 |
let $assert_text= Value returned by SSS and PS table for SSL_Certificate should be same.; |
| 109 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 110 |
source include/assert.inc; |
| 111 |
|
| 112 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cipher, 1); |
| 113 |
let $ps_value= query_get_value(select SSL_Cipher from performance_schema.replication_connection_configuration, SSL_Cipher, 1); |
| 114 |
let $assert_text= Value returned by SSS and PS table for SSL_Cipher should be same.; |
| 115 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 116 |
source include/assert.inc; |
| 117 |
|
| 118 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Key, 1); |
| 119 |
let $ps_value= query_get_value(select SSL_Key from performance_schema.replication_connection_configuration, SSL_Key, 1); |
| 120 |
let $assert_text= Value returned by SSS and PS table for SSL_Key should be same.; |
| 121 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 122 |
source include/assert.inc; |
| 123 |
|
| 124 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1); |
| 125 |
let $ps_value= query_get_value(select SSL_Verify_Server_Certificate from performance_schema.replication_connection_configuration, SSL_Verify_Server_Certificate, 1); |
| 126 |
let $assert_text= Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.; |
| 127 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 128 |
source include/assert.inc; |
| 129 |
|
| 130 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crl, 1); |
| 131 |
let $ps_value= query_get_value(select SSL_Crl_File from performance_schema.replication_connection_configuration, SSL_Crl_File, 1); |
| 132 |
let $assert_text= Value returned by SSS and PS table for SSL_Crl_File should be same.; |
| 133 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 134 |
source include/assert.inc; |
| 135 |
|
| 136 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crlpath, 1); |
| 137 |
let $ps_value= query_get_value(select SSL_Crl_Path from performance_schema.replication_connection_configuration, SSL_Crl_Path, 1); |
| 138 |
let $assert_text= Value returned by SSS and PS table for SSL_Crl_Path should be same.; |
| 139 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 140 |
source include/assert.inc; |
| 141 |
|
| 142 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Connect_Retry, 1); |
| 143 |
let $ps_value= query_get_value(select Connection_Retry_Interval from performance_schema.replication_connection_configuration, Connection_Retry_Interval, 1); |
| 144 |
let $assert_text= Value returned by SSS and PS table for Connection_Retry_Interval should be same.; |
| 145 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 146 |
source include/assert.inc; |
| 147 |
|
| 148 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Retry_Count, 1); |
| 149 |
let $ps_value= query_get_value(select Connection_Retry_Count from performance_schema.replication_connection_configuration, Connection_Retry_Count, 1); |
| 150 |
let $assert_text= Value returned by SSS and PS table for Connection_Retry_Count should be same.; |
| 151 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 152 |
source include/assert.inc; |
| 153 |
|
| 154 |
--echo |
| 155 |
--echo # Change configuration parameters and verify that these changes |
| 156 |
--echo # are shown correctly by SELECTs from PS table. |
| 157 |
--echo |
| 158 |
|
| 159 |
# create a user for replication that requires ssl encryption |
| 160 |
--connection master |
| 161 |
create user replssl@localhost require ssl; |
| 162 |
grant replication slave on *.* to replssl@localhost; |
| 163 |
--source include/sync_slave_sql_with_master.inc |
| 164 |
|
| 165 |
# Setup slave to use SSL for connection to master |
| 166 |
--source include/stop_slave.inc |
| 167 |
replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR; |
| 168 |
replace_column 2 ####; |
| 169 |
eval CHANGE REPLICATION SOURCE to |
| 170 |
SOURCE_USER= 'replssl', |
| 171 |
SOURCE_PASSWORD= '', |
| 172 |
SOURCE_RETRY_COUNT= 1, |
| 173 |
SOURCE_SSL= 1, |
| 174 |
SOURCE_SSL_CA= '$MYSQL_TEST_DIR/std_data/cacert.pem', |
| 175 |
SOURCE_SSL_CERT= '$MYSQL_TEST_DIR/std_data/client-cert.pem', |
| 176 |
SOURCE_SSL_KEY= '$MYSQL_TEST_DIR/std_data/client-key.pem'; |
| 177 |
|
| 178 |
--echo |
| 179 |
--echo # Checking SSL parameters, they were empty in tests done in the |
| 180 |
--echo # previous section. |
| 181 |
--echo |
| 182 |
|
| 183 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1); |
| 184 |
let $ps_value= query_get_value(select SSL_Allowed from performance_schema.replication_connection_configuration, SSL_Allowed, 1); |
| 185 |
let $assert_text= Value returned by SSS and PS table for SSL_Allowed should be same.; |
| 186 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 187 |
source include/assert.inc; |
| 188 |
|
| 189 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_File, 1); |
| 190 |
let $ps_value= query_get_value(select SSL_CA_File from performance_schema.replication_connection_configuration, SSL_CA_File, 1); |
| 191 |
let $assert_text= Value returned by SSS and PS table for SSL_CA_File should be same.; |
| 192 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 193 |
source include/assert.inc; |
| 194 |
|
| 195 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_Path, 1); |
| 196 |
let $ps_value= query_get_value(select SSL_CA_Path from performance_schema.replication_connection_configuration, SSL_CA_Path, 1); |
| 197 |
let $assert_text= Value returned by SSS and PS table for SSL_CA_Path should be same.; |
| 198 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 199 |
source include/assert.inc; |
| 200 |
|
| 201 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cert, 1); |
| 202 |
let $ps_value= query_get_value(select SSL_Certificate from performance_schema.replication_connection_configuration, SSL_Certificate, 1); |
| 203 |
let $assert_text= Value returned by SSS and PS table for SSL_Certificate should be same.; |
| 204 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 205 |
source include/assert.inc; |
| 206 |
|
| 207 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cipher, 1); |
| 208 |
let $ps_value= query_get_value(select SSL_Cipher from performance_schema.replication_connection_configuration, SSL_Cipher, 1); |
| 209 |
let $assert_text= Value returned by SSS and PS table for SSL_Cipher should be same.; |
| 210 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 211 |
source include/assert.inc; |
| 212 |
|
| 213 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Key, 1); |
| 214 |
let $ps_value= query_get_value(select SSL_Key from performance_schema.replication_connection_configuration, SSL_Key, 1); |
| 215 |
let $assert_text= Value returned by SSS and PS table for SSL_Key should be same.; |
| 216 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 217 |
source include/assert.inc; |
| 218 |
|
| 219 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1); |
| 220 |
let $ps_value= query_get_value(select SSL_Verify_Server_Certificate from performance_schema.replication_connection_configuration, SSL_Verify_Server_Certificate, 1); |
| 221 |
let $assert_text= Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.; |
| 222 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 223 |
source include/assert.inc; |
| 224 |
|
| 225 |
# We cannot set master_ssl=1 when both ssl_crl and ssl_crlpath are used in |
| 226 |
# CHANGE MASTER. (See bug#18165937) |
| 227 |
CHANGE REPLICATION SOURCE to SOURCE_SSL=0; |
| 228 |
replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR; |
| 229 |
replace_column 2 ####; |
| 230 |
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'; |
| 231 |
|
| 232 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crl, 1); |
| 233 |
let $ps_value= query_get_value(select SSL_Crl_File from performance_schema.replication_connection_configuration, SSL_Crl_File, 1); |
| 234 |
let $assert_text= Value returned by SSS and PS table for SSL_Crl_File should be same.; |
| 235 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 236 |
source include/assert.inc; |
| 237 |
|
| 238 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crlpath, 1); |
| 239 |
let $ps_value= query_get_value(select SSL_Crl_Path from performance_schema.replication_connection_configuration, SSL_Crl_Path, 1); |
| 240 |
let $assert_text= Value returned by SSS and PS table for SSL_Crl_Path should be same.; |
| 241 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 242 |
source include/assert.inc; |
| 243 |
|
| 244 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_TLS_Version, 1); |
| 245 |
let $ps_value= query_get_value(select Tls_Version from performance_schema.replication_connection_configuration, Tls_Version, 1); |
| 246 |
let $assert_text= Value returned by SSS and PS table for TLS version should be same.; |
| 247 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 248 |
source include/assert.inc; |
| 249 |
|
| 250 |
--echo |
| 251 |
--echo # Test with servers in gtid-mode=on. |
| 252 |
--echo |
| 253 |
|
| 254 |
let $rpl_server_number= 1; |
| 255 |
let $rpl_start_with_gtids= 1; |
| 256 |
source include/rpl_restart_server.inc; |
| 257 |
|
| 258 |
let $rpl_server_number= 2; |
| 259 |
let $rpl_start_with_gtids= 1; |
| 260 |
source include/rpl_restart_server.inc; |
| 261 |
|
| 262 |
--connection slave |
| 263 |
|
| 264 |
--echo |
| 265 |
--echo # 1) Test for Auto_position= 0. |
| 266 |
--echo |
| 267 |
|
| 268 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Auto_Position, 1); |
| 269 |
let $ps_value= query_get_value(select Auto_Position from performance_schema.replication_connection_configuration, Auto_Position, 1); |
| 270 |
let $assert_text= Value returned by SSS and PS table for Auto_Position should be same.; |
| 271 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 272 |
source include/assert.inc; |
| 273 |
|
| 274 |
replace_column 2 ####; |
| 275 |
CHANGE REPLICATION SOURCE to |
| 276 |
SOURCE_USER = 'root', |
| 277 |
SOURCE_AUTO_POSITION= 1; |
| 278 |
|
| 279 |
--echo |
| 280 |
--echo # 2) Test for Auto_position= 1. |
| 281 |
--echo |
| 282 |
|
| 283 |
let $sss_value= query_get_value(SHOW SLAVE STATUS, Auto_Position, 1); |
| 284 |
let $ps_value= query_get_value(select Auto_Position from performance_schema.replication_connection_configuration, Auto_Position, 1); |
| 285 |
let $assert_text= Value returned by SSS and PS table for Auto_Position should be same.; |
| 286 |
let $assert_cond= "$sss_value" = "$ps_value"; |
| 287 |
source include/assert.inc; |
| 288 |
|
| 289 |
let $rpl_only_running_threads= 1; |
| 290 |
|
| 291 |
# Cleanup |
| 292 |
--connection slave |
| 293 |
replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR; |
| 294 |
replace_column 2 ####; |
| 295 |
eval CHANGE REPLICATION SOURCE to |
| 296 |
SOURCE_AUTO_POSITION= 0, |
| 297 |
SOURCE_SSL_CRL= '', |
| 298 |
SOURCE_SSL_CRLPATH= '', |
| 299 |
SOURCE_SSL_CA= '', |
| 300 |
SOURCE_SSL_CERT= '', |
| 301 |
SOURCE_SSL_KEY=''; |
| 302 |
|
| 303 |
# Reset the gtid mode if the test started with gtid_mode=OFF |
| 304 |
--if ($gtid_mode_on == 0) { |
| 305 |
--let $rpl_gtid_mode = 0 |
| 306 |
--let $rpl_set_enforce_gtid_consistency= 0 |
| 307 |
} |
| 308 |
--let $no_extra_info= 1 |
| 309 |
--source include/rpl_set_gtid_mode.inc |
| 310 |
|
| 311 |
|
| 312 |
--connection master |
| 313 |
drop user replssl@localhost; |
| 314 |
--connection slave |
| 315 |
drop user replssl@localhost; |
| 316 |
|
| 317 |
source include/rpl_end.inc; |