Debian Codegraph @

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

raw
1 ###############################################################################
2 #
3 # Error in the election process that prevent its progress shall
4 # make the server leave the group (if configured to) as its configuration
5 # may have deviated from the group.
6 #
7 # Test:
8 # 0. This test requires three servers
9 # 1. Server1 start, bootstrap the group
10 # 2. Start server2 and server3
11 # 3. Fake a stopped applier on server2
12 # 4. Set server2 weight higher to be new primary server
13 # 5. Stop primary member that will force election from another member
14 # 6. Server2 will fail (applier thread stopped) and leave the group
15 # 7. Server3 is the new primary
16 # 8. Confirm server2 is on ERROR state
17 # 9. Cleanup
18 #
19 ###############################################################################
20
21 --source include/have_debug.inc
22 --source include/have_group_replication_plugin.inc
23 --let $rpl_server_count= 3
24 --let $rpl_skip_group_replication_start= 1
25 --let $rpl_group_replication_single_primary_mode=1
26 --source include/group_replication.inc
27
28 --echo
29 --echo # 1. Server1 start, bootstrap the group
30
31 --source include/start_and_bootstrap_group_replication.inc
32
33 --echo
34 --echo # 2. Start server2 and server3
35
36 --let $rpl_connection_name= server2
37 --source include/rpl_connection.inc
38
39 set session sql_log_bin=0;
40 call mtr.add_suppression("There was an issue on the primary election process: Could not wait for the execution of local transactions. The member will now leave the group.");
41 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
42 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
43 set session sql_log_bin=1;
44
45 --source include/start_group_replication.inc
46
47 --let $rpl_connection_name= server3
48 --source include/rpl_connection.inc
49 --source include/start_group_replication.inc
50
51 --let $server3_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
52
53 --echo
54 --echo # 3. Fake a stopped applier on server2
55
56 --let $rpl_connection_name= server2
57 --source include/rpl_connection.inc
58 SET @@GLOBAL.DEBUG= '+d,group_replication_wait_for_gtid_execution_force_error';
59
60 --echo
61 --echo # 4. Set server2 weight higher to be new primary server
62
63 SET GLOBAL group_replication_member_weight= 90;
64
65 --echo
66 --echo # 5. Stop primary member that will force election from another member
67
68 --let $rpl_connection_name= server1
69 --source include/rpl_connection.inc
70
71 --source include/stop_group_replication.inc
72
73 --echo
74 --echo # 6. Server2 will fail (applier thread stopped) and leave the group
75
76 --let $rpl_connection_name= server3
77 --source include/rpl_connection.inc
78
79 --let $group_replication_number_of_members= 1
80 --source include/gr_wait_for_number_of_members.inc
81
82 --echo # 7. Server3 is the new primary
83
84 --source include/gr_assert_primary_member.inc
85
86 --echo
87 --echo # 8. Confirm server2 is on ERROR state
88
89 --let $rpl_connection_name= server2
90 --source include/rpl_connection.inc
91
92 --let $group_replication_member_state= ERROR
93 --source include/gr_wait_for_member_state.inc
94
95 SET @@GLOBAL.DEBUG= '-d,group_replication_wait_for_gtid_execution_force_error';
96
97 --echo
98 --echo # 9. Cleanup
99
100 SET @@GLOBAL.group_replication_member_weight= DEFAULT;
101
102 --let $rpl_group_replication_reset_persistent_vars=1
103 --let $rpl_group_replication_single_primary_mode=1
104 --source include/group_replication_end.inc