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
|
################################################################################
# Test case to verify that binlog dump thread is stopped on:
# 1. STOP GR
# 2. Member leaves the group on error
#
# Test:
# 0. This test requires 3 members.
# M1 and M2 are connected through GR.
# M3 connects with M1 and M2 through asynchronous replication.
# 1. Start GR on M1(primary) and create table t1.
# 2. Start M2.
# 3. Create and start new channel ch3_1: M1(master), M3(slave)
# and ch4_1: M1(master), M4(slave).
# 4. Insert row on M1 and table t1 with binlog off.
# 5. Insert same row in M2 so that M1 stops due to primary key coflict.
# 6. Wait for GR to ERROR out on M1.
# 7. Assert channels ch3_1 and ch4_1 have errored out.
# Assert binlog dump thread is not present in threads table.
# 8. Restore M3 channel.
# 9. Start GR on M1 and channel ch3_1: M1(master), M3(slave)
# and ch4_1: M1(master), M4(slave).
# 10. Stop GR on M1.
# 11. Assert channels ch3_1 and ch4_1 have errored out.
# Assert binlog dump thread is not present in threads table.
# 12. Cleanup
################################################################################
--source include/big_test.inc
--source include/have_group_replication_plugin.inc
--let $rpl_server_count=4
--let $rpl_skip_group_replication_start= 1
--let $rpl_group_replication_single_primary_mode=1
--source include/group_replication.inc
--echo
--echo # 1. Start GR on M1(primary) and create table t1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
set session sql_log_bin=0;
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Could not execute Write_rows event on table .*");
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Worker . failed executing transaction .*");
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': ... The replica coordinator and worker threads are stopped, .*");
call mtr.add_suppression("Replica: Duplicate entry '.' for key 't1.PRIMARY' Error_code: MY-001062");
call mtr.add_suppression("The applier thread execution was aborted. .*");
call mtr.add_suppression("Error running query, replica SQL thread aborted. .*");
call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
set session sql_log_bin=1;
--source include/start_and_bootstrap_group_replication.inc
CREATE TABLE test.t1 (a INT PRIMARY KEY NOT NULL);
INSERT INTO test.t1 values (1);
--echo
--echo # 2. Start M2.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--echo
--echo # 3. Create and start new channel ch3_1: M1(master), M3(slave)
--echo # and ch4_1: M1(master), M4(slave).
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
set session sql_log_bin=0;
call mtr.add_suppression("Error reading packet from server for channel 'ch3_1': .*");
set session sql_log_bin=1;
--replace_result $SERVER_MYPORT_1 SERVER_1_PORT
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=$SERVER_MYPORT_1 for channel 'ch3_1'
--let $rpl_channel_name='ch3_1'
--source include/start_slave.inc
--let $rpl_channel_name=
--let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.tables WHERE TABLE_SCHEMA="test" AND TABLE_NAME="t1"
--source include/wait_condition.inc
--let $wait_condition= SELECT COUNT(*)=1 FROM test.t1 WHERE a=1
--source include/wait_condition.inc
--let $rpl_connection_name= server4
--source include/rpl_connection.inc
set session sql_log_bin=0;
call mtr.add_suppression("Error reading packet from server for channel 'ch4_1': .*");
set session sql_log_bin=1;
--replace_result $SERVER_MYPORT_1 SERVER_1_PORT
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=$SERVER_MYPORT_1 for channel 'ch4_1'
--let $rpl_channel_name='ch4_1'
--source include/start_slave.inc
--let $rpl_channel_name=
--let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.tables WHERE TABLE_SCHEMA="test" AND TABLE_NAME="t1"
--source include/wait_condition.inc
--let $wait_condition= SELECT COUNT(*)=1 FROM test.t1 WHERE a=1
--source include/wait_condition.inc
--echo
--echo # 4. Insert row on M1 and table t1 with binlog off.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET sql_log_bin=0;
INSERT INTO test.t1 values (2);
SET sql_log_bin=1;
--echo
--echo # 5. Insert same row in M2 so that M1 stops due to primary key coflict.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET GLOBAL super_read_only= 0;
INSERT INTO test.t1 values (2);
--echo
--echo # 6. Wait for GR to ERROR out on M1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc
SET GLOBAL super_read_only= FALSE;
SET sql_log_bin=0;
INSERT INTO test.t1 values (3);
SET sql_log_bin=1;
SET GLOBAL super_read_only= TRUE;
--echo
--echo # 7. Assert channels ch3_1 and ch4_1 have errored out.
--echo # Assert binlog dump thread is not present in threads table.
--let $assert_text= Thread Binlog Dump GTID is killed.
--let $assert_cond= "[SELECT COUNT(*) FROM information_schema.processlist WHERE COMMAND=\"Binlog Dump%\"]" = "0"
--source include/assert.inc
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.3.err
--let $assert_select= Lost connection to MySQL server during query \(server_errno=2013\)
--let $assert_count= 1
--let $assert_text= Master connection is lost.
--source include/assert_grep.inc
--let $assert_text= Slave connection is stopped.
--let $assert_cond= "[SELECT COUNT(*) FROM test.t1 WHERE a=3]" = "0"
--source include/assert.inc
--let $rpl_connection_name= server4
--source include/rpl_connection.inc
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.4.err
--let $assert_select= Lost connection to MySQL server during query \(server_errno=2013\)
--let $assert_count= 1
--let $assert_text= Master connection is lost.
--source include/assert_grep.inc
--let $assert_text= Slave connection is stopped.
--let $assert_cond= "[SELECT COUNT(*) FROM test.t1 WHERE a=3]" = "0"
--source include/assert.inc
--echo
--echo # 8. Restore M3 channel.
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $rpl_channel_name='ch3_1'
--source include/stop_slave.inc
--let $rpl_channel_name=
--let $rpl_connection_name= server4
--source include/rpl_connection.inc
--let $rpl_channel_name='ch4_1'
--source include/stop_slave.inc
--let $rpl_channel_name=
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET GLOBAL super_read_only= FALSE;
SET sql_log_bin=0;
DELETE FROM test.t1 WHERE a=3;
SET sql_log_bin=1;
SET GLOBAL super_read_only= TRUE;
--echo
--echo # 9. Start GR on M1 and channel ch3_1: M1(master), M3(slave)
--echo # and ch4_1: M1(master), M4(slave).
--source include/stop_group_replication.inc
SET sql_log_bin=0;
DELETE FROM test.t1 WHERE a=2;
SET sql_log_bin=1;
--source include/start_group_replication.inc
--replace_result $server1_uuid SERVER1_UUID
--eval SELECT group_replication_set_as_primary("$server1_uuid")
INSERT INTO test.t1 values (3);
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $rpl_channel_name='ch3_1'
--source include/start_slave.inc
--let $rpl_channel_name=
--let $wait_condition= SELECT COUNT(*)=1 FROM test.t1 WHERE a=3
--source include/wait_condition.inc
--let $rpl_connection_name= server4
--source include/rpl_connection.inc
--let $rpl_channel_name='ch4_1'
--source include/start_slave.inc
--let $rpl_channel_name=
--let $wait_condition= SELECT COUNT(*)=1 FROM test.t1 WHERE a=3
--source include/wait_condition.inc
--echo
--echo # 10. Stop GR on M1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
SET GLOBAL super_read_only= FALSE;
SET sql_log_bin=0;
INSERT INTO test.t1 values (4);
SET sql_log_bin=1;
SET GLOBAL super_read_only= TRUE;
--echo
--echo # 11. Assert channels ch3_1 and ch4_1 have errored out.
--echo # Assert binlog dump thread is not present in threads table.
--let $assert_text= Thread Binlog Dump GTID is killed.
--let $assert_cond= "[SELECT COUNT(*) FROM information_schema.processlist WHERE COMMAND=\"Binlog Dump%\"]" = "0"
--source include/assert.inc
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.3.err
--let $assert_select= Lost connection to MySQL server during query \(server_errno=2013\)
--let $assert_count= 2
--let $assert_text= Master connection is lost.
--source include/assert_grep.inc
--let $assert_text= Slave connection is stopped.
--let $assert_cond= "[SELECT COUNT(*) FROM test.t1 WHERE a=4]" = "0"
--source include/assert.inc
--let $rpl_connection_name= server4
--source include/rpl_connection.inc
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.4.err
--let $assert_select= Lost connection to MySQL server during query \(server_errno=2013\)
--let $assert_count= 2
--let $assert_text= Master connection is lost.
--source include/assert_grep.inc
--let $assert_text= Slave connection is stopped.
--let $assert_cond= "[SELECT COUNT(*) FROM t1 WHERE a=4]" = "0"
--source include/assert.inc
--echo
--echo # 12. Cleanup
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET GLOBAL super_read_only= FALSE;
SET sql_log_bin=0;
DELETE FROM test.t1 WHERE a=4;
SET sql_log_bin=1;
SET GLOBAL super_read_only= TRUE;
--source include/start_group_replication.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
DROP TABLE test.t1;
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $rpl_channel_name='ch3_1'
--source include/stop_slave.inc
--let $rpl_channel_name=
RESET SLAVE ALL FOR CHANNEL 'ch3_1';
--source include/start_group_replication.inc
--let $rpl_connection_name= server4
--source include/rpl_connection.inc
--let $rpl_channel_name='ch4_1'
--source include/stop_slave.inc
--let $rpl_channel_name=
RESET SLAVE ALL FOR CHANNEL 'ch4_1';
--source include/start_group_replication.inc
--source include/group_replication_end.inc
|