################################################################################ # This test evaluates that recovery fails properly when the donors available # have conflicting data. # # The test steps are: # 0) The test requires two servers: M1 and M2. # 1) Bootstrap start M1. Create table t1 and insert some data for recovery. # 2) Create table t1 on M2 before starting. Start GR on M2. # 3) With a low number of retries watch recovery fail on M2. It should go # to ERROR state. # 4) Remove the data in the joiner M2 and restart GR. All is OK. Validate # data. # 5) Clean up. ################################################################################ --source include/big_test.inc --let $group_replication_group_name=c1ef5e40-262a-11e5-867f-0800200c9a66 --source include/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --source include/group_replication.inc --echo # --echo # Setup a new group --echo # --connection server1 --echo server1 --source include/start_and_bootstrap_group_replication.inc --echo # Add some data for recovery CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); --echo # --echo # Add the same data to member 2 before the joining phase --echo # --connection server2 --echo server2 --echo # Add some data to crash recovery CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (2); --echo # --echo # Start group replication on member 2 and it goes to an ERROR state --echo # SET SESSION sql_log_bin= 0; call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Error 'Table 't1' already exists'*"); call mtr.add_suppression("Replica: Table 't1' already exists*"); call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Worker .* failed executing transaction .*; Error 'Table 't1' already exists' on query."); call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': ... The replica coordinator and worker threads are stopped.*"); call mtr.add_suppression("Error while starting the group replication incremental recovery receiver/applier threads"); call mtr.add_suppression("Maximum number of retries when*"); call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group."); call mtr.add_suppression(".*This member has more executed transactions *.*"); call mtr.add_suppression("The member contains transactions not present in the group. It is only allowed to *.*"); call mtr.add_suppression("The member is leaving a group without being on one"); call mtr.add_suppression("The member is already leaving or joining a group."); call mtr.add_suppression("Error leaving the group"); call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); SET SESSION sql_log_bin= 1; SET @debug_save_retries= @@GLOBAL.group_replication_recovery_retry_count; SET GLOBAL group_replication_recovery_retry_count= 1; RESET MASTER; --let $group_replication_start_member_state= ERROR --source include/start_group_replication.inc --echo # --echo # Remove the conflicting data and see that all goes fine now --echo # --source include/stop_group_replication.inc DROP TABLE t1; # Reset the server GTIDs so rpl_end don't blocks RESET MASTER; SET @@GLOBAL.group_replication_recovery_retry_count= @debug_save_retries; --source include/start_group_replication.inc --let $assert_text= On the recovered member, the table should exist and have 1 elements --let $assert_cond= [SELECT COUNT(*) FROM t1] = 1; --source include/assert.inc --echo # --echo # Cleaning up --echo # DROP TABLE t1; --source include/group_replication_end.inc