1###############################################################################
2#
3# Any local failure in a configuration change that prevents its progress
4# shall make the server leave the group and follow
5# group_replication_exit_state_action as its configuration may have deviated
6# from the group.
7#
8# Test:
9#   0. This test requires three servers in single primary mode
10#   1. Start the servers, server 2 is configured with
11#      group_replication_exit_state_action = OFFLINE_MODE
12#   2. Stop the applier sql thread in server2
13#   3. Change to multi primary mode
14#   4. Server2 must leave the group.
15#   5. Server2 must change to ERROR state and enable offline_mode
16#   6. Cleanup
17#
18###############################################################################
19
20--source include/big_test.inc
21--source include/have_group_replication_plugin.inc
22--let $rpl_server_count= 3
23--let $rpl_skip_group_replication_start= 1
24--let $rpl_group_replication_single_primary_mode=1
25--source include/group_replication.inc
26
27--echo
28--echo # 1. Start the servers, server 2 is configured with
29--echo #    group_replication_exit_state_action = OFFLINE_MODE
30
31--source include/start_and_bootstrap_group_replication.inc
32
33--let $rpl_connection_name= server2
34--source include/rpl_connection.inc
35
36set session sql_log_bin=0;
37call mtr.add_suppression("A configuration change was killed in this member. The member will now leave the group as its configuration may have diverged.");
38call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
39call mtr.add_suppression("The server was automatically set into offline mode after an error was detected.");
40call mtr.add_suppression("Error while executing a group configuration operation: This operation ended in error as it was not possible to wait for the execution of the plugin queued transactions");
41
42set session sql_log_bin=1;
43
44SET @saved_exit_state_action = @@GLOBAL.group_replication_exit_state_action;
45SET @@GLOBAL.group_replication_exit_state_action = OFFLINE_MODE;
46
47--source include/start_group_replication.inc
48
49--let $rpl_connection_name= server3
50--source include/rpl_connection.inc
51--source include/start_group_replication.inc
52
53--echo
54--echo # 2. Stop the applier sql thread in server2
55
56--let $rpl_connection_name= server2
57--source include/rpl_connection.inc
58--source include/gr_stop_applier_sql_thread.inc
59
60--echo
61--echo # 3. Change to multi primary mode
62
63--let $rpl_connection_name= server1
64--source include/rpl_connection.inc
65
66SELECT group_replication_switch_to_multi_primary_mode();
67
68--echo
69--echo # 4. Server2 must leave the group.
70--let $rpl_connection_name= server1
71--source include/rpl_connection.inc
72
73--let $group_replication_number_of_members= 2
74--source include/gr_wait_for_number_of_members.inc
75
76--echo
77--echo # 5. Server2 must change to ERROR state and enable offline_mode
78
79--let $rpl_connection_name= server2
80--source include/rpl_connection.inc
81
82--let $group_replication_member_state= ERROR
83--source include/gr_wait_for_member_state.inc
84
85--source include/assert_and_disable_read_only.inc
86--source include/assert_and_disable_offline_mode.inc
87
88--echo
89--echo # 6. Cleanup
90
91SET @@GLOBAL.group_replication_exit_state_action = @saved_exit_state_action;
92
93--let $rpl_group_replication_reset_persistent_vars=1
94--let $rpl_group_replication_single_primary_mode=1
95--source include/group_replication_end.inc
96