# # When a connection is established with a group, all members on UNREACHABLE # state shall be present on senders list # # Test: # 0. This test requires 4 servers. 3 being on GR and 1 replica # 1. Bootstrap GR on server1. Join server2 and server3 # 2. Kill server1. # Server will return without starting Group Replication. # 3. Create and start the managed channel connected to server1. # 4. Validate sender list has three possible connections # 5. Clean Up. # --source include/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --let $rpl_server_count= 4 --let $rpl_group_replication_single_primary_mode=1 --source include/group_replication.inc --echo --echo # 1. Bootstrap GR on server1. Join server2 and server3 --echo --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $server1_uuid= `SELECT @@server_uuid` SET GLOBAL group_replication_member_expel_timeout = 3600; --source include/start_and_bootstrap_group_replication.inc --let $_tmp_gr_group_name= `SELECT @@GLOBAL.group_replication_group_name` --let $rpl_connection_name= server2 --source include/rpl_connection.inc --let $server2_uuid= `SELECT @@server_uuid` SET GLOBAL group_replication_member_expel_timeout = 3600; --source include/start_group_replication.inc --let $rpl_connection_name= server3 --source include/rpl_connection.inc --let $server3_uuid= `SELECT @@server_uuid` SET GLOBAL group_replication_member_expel_timeout = 3600; --source include/start_group_replication.inc --echo --echo # 2. Kill server1. --echo # Server will return without starting Group Replication. --echo --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/kill_and_restart_mysqld.inc --let $rpl_server_number= 1 --source include/rpl_reconnect.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --let $group_replication_member_state= UNREACHABLE --let $group_replication_member_id= $server1_uuid --source include/gr_wait_for_member_state.inc --let $rpl_connection_name= server3 --source include/rpl_connection.inc --let $group_replication_member_state= UNREACHABLE --let $group_replication_member_id= $server1_uuid --source include/gr_wait_for_member_state.inc --echo --echo # 3. Create and start the managed channel connected to server1. --echo --let $rpl_connection_name= server4 --source include/rpl_connection.inc --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 $_tmp_gr_group_name FAILOVER_GROUP_NAME --eval SELECT asynchronous_connection_failover_add_managed('ch2_4', 'GroupReplication', '$_tmp_gr_group_name', '127.0.0.1', $SERVER_MYPORT_2, '', 60, 80); --replace_result $SERVER_MYPORT_2 SERVER_2_PORT --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_CONNECTION_AUTO_FAILOVER=1, SOURCE_PORT=$SERVER_MYPORT_2, SOURCE_RETRY_COUNT=1, SOURCE_CONNECT_RETRY=1 FOR CHANNEL 'ch2_4' --let $rpl_channel_name='ch2_4' --source include/start_slave.inc --let $rpl_channel_name= --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_connection_status WHERE channel_name='ch2_4' AND source_uuid='$server2_uuid' AND service_state ='ON'; --source include/wait_condition.inc --echo --echo # 4. Validate sender list has three possible connections --echo --let $wait_condition= SELECT COUNT(*)=3 FROM performance_schema.replication_asynchronous_connection_failover --source include/wait_condition.inc --let $assert_text= 'There is a row in performance_schema.replication_asynchronous_connection_failover for server1' --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE port=$SERVER_MYPORT_1, count, 1] = 1 --source include/assert.inc --echo --echo # 5. Revert group_replication_member_expel_timeout to the --echo # default value on server2 and server3, which will cause --echo # server1 to be expelled. --echo --let $rpl_connection_name= server2 --source include/rpl_connection.inc SET GLOBAL group_replication_member_expel_timeout = DEFAULT; --let $rpl_connection_name= server3 --source include/rpl_connection.inc SET GLOBAL group_replication_member_expel_timeout = DEFAULT; --let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members --source include/wait_condition.inc --echo --echo # 6. server1 was removed from performance_schema.replication_asynchronous_connection_failover table. --echo --let $rpl_connection_name= server4 --source include/rpl_connection.inc --let $wait_condition= SELECT COUNT(*)=2 FROM performance_schema.replication_asynchronous_connection_failover --source include/wait_condition.inc --let $assert_text= 'There is no row in performance_schema.replication_asynchronous_connection_failover for server1' --let $assert_cond= [SELECT COUNT(*) count FROM performance_schema.replication_asynchronous_connection_failover WHERE port=$SERVER_MYPORT_1, count, 1] = 0 --source include/assert.inc --echo --echo # 7. Clean Up. --echo SET SESSION sql_log_bin = 0; call mtr.add_suppression("The source .* for channel 'ch2_4' has joined the group .*, and so added its entry into replication_asynchronous_connection_failover table."); call mtr.add_suppression("The Monitor IO thread detected that the source .* does not belong to the group majority, thence the channel .* will try to connect to another source."); call mtr.add_suppression("The source .* for channel 'ch2_4' has left the group .*, and so removed its entry from replication_asynchronous_connection_failover table."); call mtr.add_suppression("The group .* for the channel .* has been removed, and so removed its entry from replication_asynchronous_connection_failover_managed and all the group members from replication_asynchronous_connection_failover table."); call mtr.add_suppression("The group .* for the channel .* has been added, and so added its entry in replication_asynchronous_connection_failover_managed and source to replication_asynchronous_connection_failover table."); SET SESSION sql_log_bin = 1; --let $rpl_channel_name='ch2_4' --source include/stop_slave.inc --let $rpl_reset_slave_all= 1 --let $rpl_multi_source= 1 --source include/rpl_reset_slave.inc --let $rpl_channel_name= --let $rpl_reset_slave_all= --let $rpl_multi_source= --replace_result $group_replication_group_name GROUP_NAME --eval SELECT asynchronous_connection_failover_delete_managed('ch2_4', '$group_replication_group_name') --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET GLOBAL group_replication_member_expel_timeout = DEFAULT; --let $rpl_skip_sync= 1 --let $rpl_only_running_threads= 1 --source include/group_replication_end.inc