Debian Codegraph @

mysql-test/suite/group_replication/t/gr_recovery_conflicting_data_failure.test

raw
1 ################################################################################
2 # This test evaluates that recovery fails properly when the donors available
3 # have conflicting data.
4 #
5 # The test steps are:
6 # 0) The test requires two servers: M1 and M2.
7 # 1) Bootstrap start M1. Create table t1 and insert some data for recovery.
8 # 2) Create table t1 on M2 before starting. Start GR on M2.
9 # 3) With a low number of retries watch recovery fail on M2. It should go
10 # to ERROR state.
11 # 4) Remove the data in the joiner M2 and restart GR. All is OK. Validate
12 # data.
13 # 5) Clean up.
14 ################################################################################
15
16 --source include/big_test.inc
17 --let $group_replication_group_name=c1ef5e40-262a-11e5-867f-0800200c9a66
18 --source include/have_group_replication_plugin.inc
19 --let $rpl_skip_group_replication_start= 1
20 --source include/group_replication.inc
21
22 --echo #
23 --echo # Setup a new group
24 --echo #
25
26 --connection server1
27 --echo server1
28 --source include/start_and_bootstrap_group_replication.inc
29
30 --echo # Add some data for recovery
31
32 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
33 INSERT INTO t1 VALUES (1);
34
35 --echo #
36 --echo # Add the same data to member 2 before the joining phase
37 --echo #
38
39 --connection server2
40 --echo server2
41
42 --echo # Add some data to crash recovery
43
44 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
45 INSERT INTO t1 VALUES (2);
46
47 --echo #
48 --echo # Start group replication on member 2 and it goes to an ERROR state
49 --echo #
50
51 SET SESSION sql_log_bin= 0;
52 call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Error 'Table 't1' already exists'*");
53 call mtr.add_suppression("Replica: Table 't1' already exists*");
54 call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Worker .* failed executing transaction .*; Error 'Table 't1' already exists' on query.");
55 call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': ... The replica coordinator and worker threads are stopped.*");
56 call mtr.add_suppression("Error while starting the group replication incremental recovery receiver/applier threads");
57 call mtr.add_suppression("Maximum number of retries when*");
58 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
59 call mtr.add_suppression(".*This member has more executed transactions *.*");
60 call mtr.add_suppression("The member contains transactions not present in the group. It is only allowed to *.*");
61 call mtr.add_suppression("The member is leaving a group without being on one");
62 call mtr.add_suppression("The member is already leaving or joining a group.");
63 call mtr.add_suppression("Error leaving the group");
64 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
65 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
66 SET SESSION sql_log_bin= 1;
67
68 SET @debug_save_retries= @@GLOBAL.group_replication_recovery_retry_count;
69 SET GLOBAL group_replication_recovery_retry_count= 1;
70 RESET MASTER;
71 --let $group_replication_start_member_state= ERROR
72 --source include/start_group_replication.inc
73
74 --echo #
75 --echo # Remove the conflicting data and see that all goes fine now
76 --echo #
77
78 --source include/stop_group_replication.inc
79
80 DROP TABLE t1;
81
82 # Reset the server GTIDs so rpl_end don't blocks
83 RESET MASTER;
84
85 SET @@GLOBAL.group_replication_recovery_retry_count= @debug_save_retries;
86
87 --source include/start_group_replication.inc
88
89 --let $assert_text= On the recovered member, the table should exist and have 1 elements
90 --let $assert_cond= [SELECT COUNT(*) FROM t1] = 1;
91 --source include/assert.inc
92
93 --echo #
94 --echo # Cleaning up
95 --echo #
96
97 DROP TABLE t1;
98
99 --source include/group_replication_end.inc