← Back
Editing: gr_majority_loss_5_to_2_recovery.result
############################################################ # 1. Create a group with 4 members and a table on it. include/group_replication.inc [rpl_server_count=5] Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. [connection server1] [connection server1] include/start_and_bootstrap_group_replication.inc [connection server3] include/start_group_replication.inc [connection server4] include/start_group_replication.inc [connection server5] include/start_group_replication.inc CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; include/rpl_sync.inc ############################################################ # 2. Only setup replication user and stop applier channel # on member 5, any member that will try to recover from # it will be blocked. [connection server5] SET SESSION sql_log_bin= 0; CREATE USER "recovery_user" IDENTIFIED BY "recovery_password"; GRANT REPLICATION SLAVE ON *.* TO "recovery_user"; FLUSH PRIVILEGES; SET SESSION sql_log_bin= 1; STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier"; ############################################################ # 3. Configure member 2 to use replication user, so that it # will be forced to recover from member 5, since it will # not be able to authenticate on any other member. [connection server2] CHANGE MASTER TO MASTER_USER="recovery_user", MASTER_PASSWORD="recovery_password" FOR CHANNEL "group_replication_recovery"; SET SESSION sql_log_bin= 0; call mtr.add_suppression("There was an error when connecting to the donor server.*"); call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Slave I/O for channel group_replication_recovery."); call mtr.add_suppression("Slave I/O for channel 'group_replication_recovery': Master command COM_REGISTER_SLAVE failed: Access denied for user 'recovery_user'.*"); call mtr.add_suppression("Slave I/O for channel 'group_replication_recovery': Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again.*"); call mtr.add_suppression("Slave I/O thread couldn't register on master"); call mtr.add_suppression("The member lost contact with a majority of the members in the group. Until the network is restored.*"); call mtr.add_suppression("The member resumed contact with a majority of the members in the group.*"); SET SESSION sql_log_bin= 1; SET @group_replication_recovery_reconnect_interval_saved= @@GLOBAL.group_replication_recovery_reconnect_interval; SET GLOBAL group_replication_recovery_reconnect_interval= 1; START GROUP_REPLICATION; ############################################################ # 4. Assert that member 2 is blocked on recovery while # fetching data from member 5. include/gr_wait_for_member_state.inc ############################################################ # 5. Crash three members. [connection server3] [connection server4] [connection server5] [connection server1] include/gr_wait_for_member_state.inc member5 @ server1 is marked as UNREACHABLE include/gr_wait_for_member_state.inc member4 @ server1 is marked as UNREACHABLE include/gr_wait_for_member_state.inc member3 @ server1 is marked as UNREACHABLE [connection server2] include/gr_wait_for_member_state.inc member5 @ server2 is marked as UNREACHABLE include/gr_wait_for_member_state.inc member4 @ server2 is marked as UNREACHABLE include/gr_wait_for_member_state.inc member3 @ server2 is marked as UNREACHABLE ############################################################ # 6. Unblock the group with the alive members: server 1 and 2. [connection server1] include/assert.inc [group_replication_force_members is correct] ############################################################ # 7. Configure replication user on member 1 in order to # allow member 2 to recover from it. [connection server2] include/gr_wait_for_member_state.inc [connection server1] CREATE USER "recovery_user" IDENTIFIED BY "recovery_password"; GRANT REPLICATION SLAVE ON *.* TO "recovery_user"; FLUSH PRIVILEGES; [connection server2] include/gr_wait_for_member_state.inc SET @@GLOBAL.group_replication_recovery_reconnect_interval= @group_replication_recovery_reconnect_interval_saved; ############################################################ # 8. Assert that group has 2 members: server 1 and 2. [connection server1] include/rpl_gr_wait_for_number_of_members.inc include/assert.inc [Server 1 must be present on group members] include/assert.inc [The value of view_id must be random:6] [connection server2] include/rpl_gr_wait_for_number_of_members.inc include/assert.inc [Server 2 must be present on group members] include/assert.inc [The value of view_id must be random:6] ############################################################ # 9. Execute a transaction in order to prove liveness. [connection server2] INSERT INTO t1 VALUES (1); include/sync_slave_sql_with_master.inc include/assert.inc ['There is one value in table t1'] include/diff_tables.inc [server1:test.t1, server2:test.t1] ############################################################ # 10. Clean up. [connection server_3] include/rpl_reconnect.inc include/assert.inc ['There are no values in table t1'] DROP TABLE t1; [connection server_4] include/rpl_reconnect.inc include/assert.inc ['There are no values in table t1'] DROP TABLE t1; [connection server_5] include/rpl_reconnect.inc include/assert.inc ['There are no values in table t1'] DROP TABLE t1; DROP USER "recovery_user"; FLUSH PRIVILEGES; [connection server1] DROP TABLE t1; DROP USER "recovery_user"; FLUSH PRIVILEGES; SET SESSION sql_log_bin= 0; call mtr.add_suppression("The member lost contact with a majority of the members in the group. Until the network is restored.*"); call mtr.add_suppression("The member resumed contact with a majority of the members in the group.*"); SET SESSION sql_log_bin= 1; include/group_replication_end.inc
Save File
Cancel