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
|
# ==== Purpose ====
#
# This script verifies that when cloning, replication info about
# - PRIVILEGE_CHECKS_USER
# - REQUIRE_ROW_FORMAT
# is preserved from the donor to the server invoking clone.
#
# ==== Implementation ====
#
# 1. Set up masters server_1 and server_3 with server_2 being a slave.
# 2. Create some tables for testing
# 3. On the slave
# Make channel_1 have PRIVILEGE_CHECKS_USER and REQUIRE_ROW_FORMAT
# Make channel_3 have REQUIRE_ROW_FORMAT
# 4. Install clone on server 2
# Configure server 4 to invoke clone
# 5. Verify replication info was cloned. Check:
# - PRIVILEGE_CHECKS_USER
# - REQUIRE_ROW_FORMAT
# 6. Verify other replication info was cleaned
# 7. Verify channels work when started
# 8. Cleanup
#
# ==== References ====
#
# Bug#29995256: PRIVILEGE_CHECKS_USER NOT CLONED FOR RECOVERY CHANNEL
#
--source include/big_test.inc
--source include/have_mysqld_monitoring_process.inc
--source include/have_clone_plugin.inc
--source include/not_have_privilege_checks_user.inc
--source include/have_binlog_format_row.inc
# Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE
--source include/have_slave_repository_type_table.inc
--echo #
--echo # 1. Set up masters server_1 and server_3 with server_2 being a slave.
--let $rpl_multi_source= 1
--let $rpl_topology= 1->2,3->2
--source include/rpl_init.inc
--connect(server_4,127.0.0.1,root,,test,$SERVER_MYPORT_4,)
--connect(server_4_1,127.0.0.1,root,,test,$SERVER_MYPORT_4,)
--echo #
--echo # 2. Create some tables for testing
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
--let $sync_slave_connection= server_2
--let $rpl_channel_name= 'channel_1'
--source include/sync_slave_sql_with_master.inc
--let $rpl_connection_name= server_3
--source include/rpl_connection.inc
CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
--let $sync_slave_connection= server_2
--let $rpl_channel_name= 'channel_3'
--source include/sync_slave_sql_with_master.inc
--echo #
--echo # 3. On the slave
--echo # Make channel_1 have PRIVILEGE_CHECKS_USER and REQUIRE_ROW_FORMAT
--echo # Make channel_3 have REQUIRE_ROW_FORMAT
# On slave
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--let $rpl_channel_name= 'channel_1'
--source include/stop_slave.inc
CREATE USER 'u1'@'localhost';
GRANT SESSION_VARIABLES_ADMIN, REPLICATION_APPLIER ON *.* TO 'u1'@'localhost';
GRANT CREATE,INSERT,DROP ON *.* TO 'u1'@'localhost';
CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER = 'u1'@'localhost', REQUIRE_ROW_FORMAT = 1 FOR CHANNEL 'channel_1';
--source include/start_slave.inc
--let $rpl_channel_name= 'channel_3'
--source include/stop_slave.inc
CHANGE REPLICATION SOURCE TO REQUIRE_ROW_FORMAT = 1 FOR CHANNEL 'channel_3';
--source include/start_slave.inc
--echo #
--echo # 4. Install clone on server 2
--echo # Configure server 4 to invoke clone
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--replace_result $CLONE_PLUGIN CLONE_PLUGIN
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
--let $rpl_connection_name= server_4
--source include/rpl_connection.inc
# Make server 4 run with mysqld_safe
--let $mysqld_extra_settings=--skip-replica-start=1
--source include/spawn_monitoring_process.inc
# Install clone
--replace_result $CLONE_PLUGIN CLONE_PLUGIN
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
# Set the clone valid donor list to include server 2
--replace_result $SERVER_MYPORT_2 SERVER2_PORT
--eval SET GLOBAL clone_valid_donor_list = 'localhost:$SERVER_MYPORT_2'
# Clone server 4 from server 2
--replace_result $SERVER_MYPORT_2 SERVER2_PORT
--eval CLONE INSTANCE FROM root@localhost:$SERVER_MYPORT_2 IDENTIFIED BY ''
--source include/wait_until_disconnected.inc
--let $rpl_server_number= 4
--source include/rpl_reconnect.inc
--echo #
--echo # 5. Verify replication info was cloned. Check:
--echo # - PRIVILEGE_CHECKS_USER
--echo # - REQUIRE_ROW_FORMAT
--let $channel_1_count = `SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE channel_name="channel_1" AND Privilege_checks_username = "u1" AND Privilege_checks_hostname="localhost" AND Require_row_format=1`
--let $assert_text= channel 1 was properly cloned
--let $assert_cond= $channel_1_count = 1
--source include/assert.inc
--let $channel_3_count = `SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE channel_name="channel_3" AND Require_row_format=1`
--let $assert_text= channel 3 was properly cloned
--let $assert_cond= $channel_3_count = 1
--source include/assert.inc
--let $channel_1_count = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE channel_name= "channel_1" AND privilege_checks_user = "'u1'@'localhost'" AND require_row_format=1`
--let $assert_text= Performance schema values are correct for channel 1
--let $assert_cond= $channel_1_count = 1
--source include/assert.inc
--let $channel_3_count = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE channel_name= "channel_3" AND privilege_checks_user IS NULL AND require_row_format=1`
--let $assert_text= Performance schema values are correct for channel 3
--let $assert_cond= $channel_3_count = 1
--source include/assert.inc
--echo #
--echo # 6. Verify other replication info was cleaned
--let $channel_1_count = `SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE channel_name="channel_1" AND Relay_log_pos = 4`
--let $assert_text= channel 1 was properly cleaned
--let $assert_cond= $channel_1_count = 1
--source include/assert.inc
--let $channel_3_count = `SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE channel_name="channel_3" AND Relay_log_pos = 4`
--let $assert_text= channel 3 was properly cleaned
--let $assert_cond= $channel_3_count = 1
--source include/assert.inc
--let $channel_mts_info = `SELECT COUNT(*) FROM mysql.slave_worker_info WHERE Relay_log_pos <> 0`
--let $assert_text= If present, info on MTS workers is clean
--let $assert_cond= $channel_mts_info = 0
--source include/assert.inc
--echo #
--echo # 7. Verify channels work when started
--let $rpl_channel_name=
--source include/start_slave.inc
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
INSERT INTO t1 VALUES (1);
--let $sync_slave_connection= server_4
--let $rpl_channel_name= 'channel_1'
--source include/sync_slave_sql_with_master.inc
--let $rpl_connection_name= server_3
--source include/rpl_connection.inc
INSERT INTO t3 VALUES (1);
--let $sync_slave_connection= server_4
--let $rpl_channel_name= 'channel_3'
--source include/sync_slave_sql_with_master.inc
--let $rpl_connection_name= server_4
--source include/rpl_connection.inc
--let $server_1_data = `SELECT COUNT(*) FROM test.t1`
--let $assert_text= All info from server 1 is present
--let $assert_cond= $server_1_data = 1
--source include/assert.inc
--let $server_3_data = `SELECT COUNT(*) FROM test.t3`
--let $assert_text= All info from server 3 is present
--let $assert_cond= $server_3_data = 1
--source include/assert.inc
--echo #
--echo # 8. Cleanup
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
DROP TABLE t1;
--let $sync_slave_connection= server_4
--let $rpl_channel_name= 'channel_1'
--source include/sync_slave_sql_with_master.inc
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--let $sync_slave_connection= server_2
--let $rpl_channel_name= 'channel_1'
--source include/sync_slave_sql_with_master.inc
--let $rpl_connection_name= server_3
--source include/rpl_connection.inc
DROP TABLE t3;
--let $sync_slave_connection= server_4
--let $rpl_channel_name= 'channel_3'
--source include/sync_slave_sql_with_master.inc
--let $rpl_connection_name= server_3
--source include/rpl_connection.inc
--let $sync_slave_connection= server_2
--let $rpl_channel_name= 'channel_3'
--source include/sync_slave_sql_with_master.inc
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
DROP USER 'u1'@'localhost';
UNINSTALL PLUGIN clone;
--let $rpl_connection_name= server_4
--source include/rpl_connection.inc
UNINSTALL PLUGIN clone;
--source include/clean_monitoring_process.inc
# mysqld_safe restarts but does not start slave channels
--disable_warnings
--let $rpl_channel_name=
--source include/stop_slave.inc
--enable_warnings
RESET SLAVE ALL;
DROP USER 'u1'@'localhost';
set session sql_log_bin=0;
call mtr.add_suppression("Clone removing all user data for provisioning: Started");
call mtr.add_suppression("Clone removing all user data for provisioning: Finished");
call mtr.add_suppression("Recovery from source pos [0-9]+ and file [a-zA-Z-]+\.[0-9]+ for channel 'channel_1'*");
call mtr.add_suppression("Recovery from source pos [0-9]+ and file [a-zA-Z-]+\.[0-9]+ for channel 'channel_3'*");
call mtr.add_suppression("Applier metadata information for channel 'channel_1' was found after a clone operation. Relay log recovery*");
call mtr.add_suppression("Applier metadata information for channel 'channel_3' was found after a clone operation. Relay log recovery*");
call mtr.add_suppression("Relay log recovery on channel with GTID_ONLY=1*");
set session sql_log_bin=1;
--let $rpl_skip_sync= 1
--source include/rpl_end.inc
|