Debian Codegraph @

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

raw
1 # This test evaluates that group replication will fail when the applier fails
2 # applying events on start.
3 #
4 # The test guide is:
5 # 0. A two member group with started plugins
6 # 1. Create a table t1 on server 1 and replicate
7 # 2. Insert a row on server 2 with log to the binlog disabled
8 # 3. Write the same query in server 1
9 # On server 2 the duplicated key will make the applier fail.
10 # Server 2 will leave
11 # 4. Stop server 2 and start it again. One of three things can happen:
12 # A. The applier fails after the join and the member leaves the group
13 # but the START GROUP_REPLICATION command does not fail
14 # B. The applier fails after initialization and sets the state to ERROR,
15 # making the group join fail that makes the START GROUP_REPLICATION
16 # command fail with a generic ER_GROUP_REPLICATION_CONFIGURATION.
17 # C. The applier fails and its initialization processes catches the error.
18 # During the start, it is known that the applier failed so the START
19 # GROUP_REPLICATION fails with error ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
20 # 5. Verify that member is offline after stop
21 # 6. Clean up
22 #
23
24 --source include/have_group_replication_plugin.inc
25 --source include/group_replication.inc
26
27 --echo #
28 --echo # 1. Create a table on server 1 and replicate
29 --echo #
30
31 --let $rpl_connection_name= server1
32 --source include/rpl_connection.inc
33
34 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
35
36 --source include/rpl_sync.inc
37
38 --echo #
39 --echo # 2. Insert a row on server 2 with log to the binlog disabled
40 --echo #
41
42 --let $rpl_connection_name= server2
43 --source include/rpl_connection.inc
44
45 SET SESSION sql_log_bin= 0;
46 INSERT INTO t1 VALUES (1);
47 SET SESSION sql_log_bin= 1;
48
49 --echo #
50 --echo # 3. Write the same query in server 1
51 --echo # On server 2 the duplicated key will make the applier fail.
52 --echo # Server 2 will leave
53 --echo #
54
55 --let $rpl_connection_name= server1
56 --source include/rpl_connection.inc
57
58 INSERT INTO t1 VALUES (1);
59
60 --let $rpl_connection_name= server2
61 --source include/rpl_connection.inc
62
63 --echo # Expect ERROR state.
64 --let $group_replication_member_state= ERROR
65 --source include/gr_wait_for_member_state.inc
66
67 --echo #
68 --echo # 4. Stop server 2 and start it again. One of three things can happen:
69 --echo # A. The applier fails after the join and the member leaves the group
70 --echo # but the START GROUP_REPLICATION command does not fail
71 --echo # B. The applier fails after initialization and sets the state to ERROR,
72 --echo # making the group join fail that makes the START GROUP_REPLICATION
73 --echo # command fail with a generic ER_GROUP_REPLICATION_CONFIGURATION.
74 --echo # C. The applier fails and its initialization processes catches the error.
75 --echo # During the start, it is known that the applier failed so the START
76 --echo # GROUP_REPLICATION fails with: ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
77 --echo #
78
79 --source include/stop_group_replication.inc
80
81 --error 0, ER_GROUP_REPLICATION_CONFIGURATION, ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
82 START GROUP_REPLICATION;
83
84 #Either on A. B. or C. the member will be alone in the end (ERROR or OFFLINE)
85 --let $wait_timeout= 120
86 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_group_members;
87 --source include/wait_condition.inc
88
89 --echo #
90 --echo # 5. Verify that member is offline after stop
91 --echo #
92
93 --let $skip_assert_read_only= 1
94 --source include/stop_group_replication.inc
95 --let $group_replication_member_state= OFFLINE
96 --source include/gr_wait_for_member_state.inc
97
98 --echo #
99 --echo # 6. Clean up
100 --echo #
101
102 # if START GROUP_REPLICATION succeeds the super read only will be enabled and
103 # we skip the disable on STOP. To prevent errors dropping table lets disable
104 # read_only (that will disable super read only)
105 SET GLOBAL read_only= 0;
106
107 DROP TABLE t1;
108
109 SET SESSION sql_log_bin= 0;
110 call mtr.add_suppression("Unable to initialize the Group Replication applier module.");
111 call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
112 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
113 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
114 call mtr.add_suppression("Unable to confirm whether the server has left the group or not. Check *.*");
115 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
116 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Could not execute Write_rows event on table");
117 call mtr.add_suppression("Error writing relay log configuration.");
118 call mtr.add_suppression("There was a previous plugin error while the member joined the group. The member will now exit the group.");
119 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Worker [0-9] failed executing transaction*");
120 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': ... The replica coordinator and worker threads are stopped,*");
121 call mtr.add_suppression("Can't evaluate the group replication applier execution status. Group replication recovery will shutdown to avoid data corruption.");
122 call mtr.add_suppression("Fatal error during the Recovery process of Group Replication. The server will leave the group.");
123 call mtr.add_suppression("It was not possible to identify the group replication applier thread");
124 call mtr.add_suppression("Error on group communication engine start");
125 call mtr.add_suppression("Error reading relay log event for channel 'group_replication_applier': Error purging processed logs");
126 SET SESSION sql_log_bin= 1;
127
128 --let $rpl_connection_name= server1
129 --source include/rpl_connection.inc
130
131 --source include/stop_group_replication.inc
132
133 DROP TABLE t1;
134
135 --source include/group_replication_end.inc