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 318 319 320 321 322 323 324 325 326 327
|
# ==== 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.
# - Verify different values for MASTER_USE_GTID are present in table.
# - Verify IGNORE_SERVER_IDS, DO_DOMAIN_IDS and IGNORE_DOMAIN_IDS
#
# ==== Related Worklog ====
#
# MDEV-16437: merge 5.7 P_S replication instrumentation and tables
#
source include/have_ssl_communication.inc;
source include/have_binlog_format_mixed.inc;
source include/have_perfschema.inc;
source include/master-slave.inc;
--let $assert_text= On master, the table should return an empty set.
--let $assert_cond= count(*) = 0 from performance_schema.replication_connection_configuration
--source include/rpl_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, Using_Gtid, 1);
let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
let $assert_text= Value returned by SSS and PS table for Using_Gtid 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 $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 PS table for Connection_Retry_Count should be 10.; # master-retry-count=10, as part of default my.cnf used by MTR
let $assert_cond= "$ps_value" = 10;
source include/assert.inc;
--echo
--echo # Heartbeat_Interval is part of I_S and P_S. We will compare the
--echo # two to make sure both match.
--echo
let $is_value= query_get_value(select Variable_Value from information_schema.GLOBAL_STATUS where variable_name= 'Slave_heartbeat_period', Variable_Value, 1);
let $ps_value= query_get_value(select Heartbeat_Interval from performance_schema.replication_connection_configuration, Heartbeat_Interval, 1);
let $assert_text= Value returned by IS and PS table for Heartbeat_Interval should be same.;
let $assert_cond= $is_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;
grant replication slave on *.* to replssl@localhost require ssl;
--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;
eval change master to
master_user= 'replssl',
master_password= '',
master_ssl= 1,
master_ssl_ca= '$MYSQL_TEST_DIR/std_data/cacert.pem',
master_ssl_cert= '$MYSQL_TEST_DIR/std_data/client-cert.pem',
master_ssl_key= '$MYSQL_TEST_DIR/std_data/client-key.pem';
--source include/start_slave.inc
--connection slave
--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;
--connection master
drop user replssl@localhost;
--sync_slave_with_master
--source include/stop_slave.inc
CHANGE MASTER TO
master_host= '127.0.0.1',
master_user= 'root',
master_password= '',
master_ssl_ca= '',
master_ssl_cert= '',
master_ssl_key= '',
master_ssl_verify_server_cert=0,
master_ssl=1,
master_use_gtid=no;
--source include/start_slave.inc
--echo
--echo # Test with different MASTER_USE_GTID values
--echo
--echo
--echo # 1) Test for MASTER_USE_GTID=NO
--echo
--source include/stop_slave.inc
change master to
master_user = 'root',
master_use_gtid = NO;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--echo
--echo # 2) Test for Auto_position= CURRENT_POS.
--echo
change master to
master_user = 'root',
master_use_gtid= CURRENT_POS;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--echo
--echo # 3) Test for Auto_position= SLAVE_POS
--echo
change master to
master_user = 'root',
master_use_gtid= SLAVE_POS;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--echo
--echo # Test INOGRE_SERVER_IDS
--echo
--echo
--echo # 1) Test for IGNORE_SERVER_IDS= (10, 100);
--echo
--connection slave
change master to IGNORE_SERVER_IDS= (10, 100);
let $sss_value= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
let $ps_value= query_get_value(select Ignore_Server_Ids from performance_schema.replication_connection_configuration, Ignore_Server_Ids, 1);
let $assert_text= Value returned by SSS and PS table for Ignore_server_ids should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
CHANGE MASTER TO IGNORE_SERVER_IDS=();
--echo
--echo # 2) Test for IGNORE_DOMAIN_IDS(2)
--echo
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(2), MASTER_USE_GTID=slave_pos;
--source include/start_slave.inc
let $sss_value= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
let $ps_value= query_get_value(select Repl_Ignore_Domain_Ids from performance_schema.replication_connection_configuration, Repl_Ignore_Domain_Ids, 1);
let $assert_text= Value returned by SSS and PS table for Replicate_Ignore_Domain_Ids should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--source include/stop_slave.inc
--echo
--echo # 3) Test for DO_DOMAIN_IDS(1)
--echo
CHANGE MASTER TO DO_DOMAIN_IDS=(1), IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
--source include/start_slave.inc
let $sss_value= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ps_value= query_get_value(select Repl_Do_Domain_Ids from performance_schema.replication_connection_configuration, Repl_Do_Domain_Ids, 1);
let $assert_text= Value returned by SSS and PS table for Replicate_Do_Domain_Ids should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--source include/stop_slave.inc
CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=();
--source include/start_slave.inc
source include/rpl_end.inc;
|