Debian Codegraph @

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

raw
1 ###############################################################################
2 # This test confirm that failures when starting group replication don't modify
3 # the read mode of server.
4 #
5 # Test:
6 # 0. The test requires two serves
7 # 1. Change for server 2 and stop it
8 # 2. Set READ_ONLY= ON and SUPER_READ_ONLY= ON, configure server with an
9 # invalid id and start it
10 # 3. Confirm that server is configured with READ_ONLY= ON and
11 # SUPER_READ_ONLY= ON
12 # 4. Set READ_ONLY= ON configure server with a invalid server id an start it
13 # 5. Confirm that server is configured with READ_ONLY= ON and
14 # SUPER_READ_ONLY= OFF
15 # 6. Set READ_ONLY= OFF and SUPER_READ_ONLY= OFF, configure server with an
16 # invalid id and start it
17 # 7. Confirm that server is configured with READ_ONLY= OFF and
18 # SUPER_READ_ONLY= OFF
19 # 8. Clean up
20
21
22 --source include/have_group_replication_plugin.inc
23 --source include/group_replication.inc
24
25 --echo
26 --echo # 1. Change for server 2 and stop it
27 --echo #############################################################
28 --let $rpl_connection_name= server2
29 --source include/rpl_connection.inc
30
31 SET SESSION sql_log_bin=0;
32 call mtr.add_suppression("Server id not set, will not start replica for channel 'group_replication_applier'");
33 call mtr.add_suppression("Error while starting the group replication applier thread");
34 call mtr.add_suppression("Unable to initialize the Group Replication applier module.");
35 SET SESSION sql_log_bin=1;
36
37 --let $_server_id= `SELECT @@GLOBAL.server_id`
38 --source include/stop_group_replication.inc
39
40 --echo
41 --echo # 2. Set READ_ONLY= ON and SUPER_READ_ONLY= ON, configure
42 --echo # server with and invalid id an start it
43 --echo #############################################################
44
45 SET GLOBAL super_read_only = 1;
46
47 SET GLOBAL server_id=0;
48 --error ER_BAD_REPLICA, ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
49 START GROUP_REPLICATION;
50
51 --echo
52 --echo # 3. Confirm that server is configured with READ_ONLY= ON
53 --echo # and SUPER_READ_ONLY= ON
54 --echo #############################################################
55 --source include/assert_and_disable_read_only.inc
56
57 --echo
58 --echo # 4. Set READ_ONLY= ON configure server with a invalid
59 --echo # server id an start it
60 --echo #############################################################
61
62 SET GLOBAL read_only = 1;
63
64 SET GLOBAL server_id=0;
65 --error ER_BAD_REPLICA, ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
66 START GROUP_REPLICATION;
67
68 --echo
69 --echo # 5. Confirm that server is configured with READ_ONLY= ON
70 --echo # and SUPER_READ_ONLY= OFF
71 --echo #############################################################
72
73 --let $assert_text= The read_only mode must be 1
74 --let $assert_cond= "[SELECT @@GLOBAL.read_only]" = 1;
75 --source include/assert.inc
76
77 --let $assert_text= The super_read_only mode must be 0
78 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0;
79 --source include/assert.inc
80
81 --echo
82 --echo # 6. Set READ_ONLY= OFF and SUPER_READ_ONLY= OFF, configure
83 --echo # server with and invalid id an start it
84 --echo #############################################################
85
86 SET GLOBAL read_only = 0;
87
88 SET GLOBAL server_id=0;
89 --error ER_BAD_REPLICA, ER_GROUP_REPLICATION_APPLIER_INIT_ERROR
90 START GROUP_REPLICATION;
91
92 --echo
93 --echo # 7. Confirm that server is configured with READ_ONLY= OFF
94 --echo # and SUPER_READ_ONLY= OFF
95 --echo #############################################################
96
97 --let $assert_text= The read_only mode must be 0
98 --let $assert_cond= "[SELECT @@GLOBAL.read_only]" = 0;
99 --source include/assert.inc
100
101 --let $assert_text= The super_read_only mode must be 0
102 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0;
103 --source include/assert.inc
104
105 --echo
106 --echo # 8. Clean up
107 --echo #############################################################
108
109 --eval SET GLOBAL server_id= $_server_id
110 --let $skip_assert_read_only= 1
111 --source include/group_replication_end.inc