Debian Codegraph @

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

raw
1 ################################################################################
2 # This test verifies the flow of variables SUPER_READ_ONLY and READ_ONLY by
3 # group replication.
4 # When executing the stop_group_replication.inc it validates that
5 # SUPER_READ_ONLY and READ_ONLY is ON and clear them after.
6 #
7 # Test:
8 #
9 # 0. The test requires two servers: M1 and M2.
10 # 1. Validate that independent of READ_ONLY and SUPER_READ_ONLY state, they
11 # will be set to OFF after start
12 # 1.1. Set READ_ONLY=ON and start group replication, then READ_ONLY and
13 # SUPER_READ_ONLY should be OFF
14 # 1.2. Stop group replication and READ_ONLY and SUPER_READ_ONLY should be ON
15 # 1.3. Set SUPER_READ_ONLY=ON and start group replication, then READ_ONLY and
16 # SUPER_READ_ONLY should be OFF
17 # 1.4. Stop group replication and READ_ONLY and SUPER_READ_ONLY should be ON
18 # 2. Validate that independent of READ_ONLY and SUPER_READ_ONLY state, they
19 # will be set to ON after shutdown
20 # 2.1. Start group replication, set READ_ONLY=ON and after STOP
21 # GROUP_REPLICATION will put READ_ONLY and SUPER_READ_ONLY to ON
22 # 2.2. Start group replication, set SUPER_READ_ONLY=ON and after STOP
23 # GROUP_REPLICATION will put READ_ONLY and SUPER_READ_ONLY to ON
24 #
25 ################################################################################
26
27 --source include/big_test.inc
28 --source include/have_group_replication_plugin.inc
29 --let $rpl_skip_group_replication_start= 1
30 --source include/group_replication.inc
31
32 --echo
33 --echo # 0. The test requires two servers: M1 and M2.
34 --echo #############################################################
35
36 --connection server1
37 --source include/start_and_bootstrap_group_replication.inc
38
39 --echo
40 --echo # 1. Validate that independent of READ_ONLY and
41 --echo # SUPER_READ_ONLY state, they will be set to OFF after
42 --echo # start
43 --echo #############################################################
44
45 --echo
46 --echo # 1.1. Set READ_ONLY=ON and start group replication, then
47 --echo # READ_ONLY and SUPER_READ_ONLY should be OFF
48 --echo #############################################################
49
50 --connection server2
51
52 SET GLOBAL read_only= 1;
53
54 --source include/start_group_replication.inc
55
56 --echo # The server's super_read_only mode should be 0 here.
57 --let $assert_text= The super_read_only mode should be 0 here.
58 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0;
59 --source include/assert.inc
60
61 --echo # The server's read_only mode should be 0 here.
62 --let $assert_text= The read_only mode should be 0 here.
63 --let $assert_cond= "[SELECT @@GLOBAL.read_only]" = 0;
64 --source include/assert.inc
65
66 --echo
67 --echo # 1.2. Stop group replication and READ_ONLY and
68 --echo # SUPER_READ_ONLY should be ON
69 --echo #############################################################
70
71 --source include/stop_group_replication.inc
72
73 --echo
74 --echo # 1.3. Set SUPER_READ_ONLY=ON and start group replication,
75 --echo # then READ_ONLY and SUPER_READ_ONLY should be OFF
76 --echo #############################################################
77
78 SET GLOBAL super_read_only= 1;
79
80 --source include/start_group_replication.inc
81
82 --echo # The server's super_read_only mode should be 0 here.
83 --let $assert_text= The super_read_only mode should be 0 here.
84 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0;
85 --source include/assert.inc
86
87 --echo # The server's read_only mode should be 0 here.
88 --let $assert_text= The read_only mode should be 0 here.
89 --let $assert_cond= "[SELECT @@GLOBAL.read_only]" = 0;
90 --source include/assert.inc
91
92 --echo
93 --echo # 1.4. Stop group replication and READ_ONLY and
94 --echo # SUPER_READ_ONLY should be ON
95 --echo #############################################################
96
97 --source include/stop_group_replication.inc
98
99 --echo
100 --echo # 2. Validate that independent of READ_ONLY and
101 --echo # SUPER_READ_ONLY state, they will be set to ON after
102 --echo # shutdown
103 --echo #############################################################
104
105 --echo
106 --echo # 2.1. Start group replication, set READ_ONLY=ON and after
107 --echo # STOP GROUP_REPLICATION will put READ_ONLY and
108 --echo # SUPER_READ_ONLY to ON
109 --echo #############################################################
110
111 --source include/start_group_replication.inc
112
113 SET GLOBAL read_only= 1;
114
115 --source include/stop_group_replication.inc
116
117 --echo
118 --echo # 2.2. Start group replication, set SUPER_READ_ONLY=ON and
119 --echo # after STOP GROUP_REPLICATION will put READ_ONLY and
120 --echo # SUPER_READ_ONLY to ON
121 --echo #############################################################
122
123 --source include/start_group_replication.inc
124
125 SET GLOBAL super_read_only= 1;
126
127 --source include/stop_group_replication.inc
128
129 --source include/group_replication_end.inc