Debian Codegraph @

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

raw
1 ###############################################################################
2 #
3 # All changes to the primary mode shall be recorded with SET PERSIST
4 # meaning they will have effect even after a member restart.
5 #
6 # Test:
7 # 0. This test requires two servers in single primary mode
8 # Servers have a configuration file that makes them boot in
9 # single primary mode
10 # 1. Change to multi primary mode
11 # 2. Check all variables
12 # 3. Restart Group Replication on server 2. Check all goes as planned
13 # 4. Restart server 1. Don't pass the Primary mode settings. Check all
14 # goes planned.
15 #
16 ###############################################################################
17
18 --source include/force_restart.inc
19 --source include/have_group_replication_plugin.inc
20 --let $rpl_skip_group_replication_start= 1
21 --source include/group_replication.inc
22
23 --let $assert_text= group_replication_enforce_update_everywhere_checks is ON
24 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_enforce_update_everywhere_checks]" = 0
25 --source include/assert.inc
26
27 --let $assert_text= The single primary mode should be 1 here.
28 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_single_primary_mode]" = 1;
29 --source include/assert.inc
30
31 --source include/start_and_bootstrap_group_replication.inc
32
33 --let $rpl_connection_name= server2
34 --source include/rpl_connection.inc
35
36 --source include/start_group_replication.inc
37
38 --echo
39 --echo # 1. Change to multi primary mode
40
41 --let $rpl_connection_name= server1
42 --source include/rpl_connection.inc
43
44 SELECT group_replication_switch_to_multi_primary_mode();
45
46 --echo
47 --echo # 2. Check all variables
48
49 --let $rpl_connection_name= server1
50 --source include/rpl_connection.inc
51
52 --let $assert_text= group_replication_enforce_update_everywhere_checks is ON
53 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_enforce_update_everywhere_checks]" = 1
54 --source include/assert.inc
55
56 --let $assert_text= The single primary mode should be 0 here.
57 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_single_primary_mode]" = 0;
58 --source include/assert.inc
59
60 --let $assert_text= The super_read_only mode should be 0 here.
61 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0;
62 --source include/assert.inc
63
64 --let $rpl_connection_name= server2
65 --source include/rpl_connection.inc
66
67 --let $assert_text= group_replication_enforce_update_everywhere_checks is ON
68 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_enforce_update_everywhere_checks]" = 1
69 --source include/assert.inc
70
71 --let $assert_text= The single primary mode should be 0 here.
72 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_single_primary_mode]" = 0;
73 --source include/assert.inc
74
75 --let $assert_text= The super_read_only mode should be 0 here.
76 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0;
77
78 --echo
79 --echo # 3. Restart Group Replication on server 2. Check all goes as planned
80
81 --let $rpl_connection_name= server2
82 --source include/rpl_connection.inc
83
84 --source include/stop_group_replication.inc
85 --source include/start_group_replication.inc
86
87 --let $assert_text= group_replication_enforce_update_everywhere_checks is ON
88 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_enforce_update_everywhere_checks]" = 1
89 --source include/assert.inc
90
91 --let $assert_text= The single primary mode should be 0 here.
92 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_single_primary_mode]" = 0;
93 --source include/assert.inc
94
95 --let $assert_text= The super_read_only mode should be 0 here.
96 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0;
97
98 --echo
99 --echo # 4. Restart server 1. Don't pass the Primary mode settings. Check all
100 --echo # goes planned.
101 --source include/force_restart.inc
102
103 --let $rpl_connection_name= server1
104 --source include/rpl_connection.inc
105
106 --let $allow_rpl_inited=1
107 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
108 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
109 --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group-replication-group-name=$group_replication_group_name
110 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
111 --source include/restart_mysqld.inc
112
113 --let $rpl_server_number= 1
114 --source include/rpl_reconnect.inc
115
116 --let $assert_text= group_replication_enforce_update_everywhere_checks is ON
117 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_enforce_update_everywhere_checks]" = 1
118 --source include/assert.inc
119
120 --let $assert_text= The single primary mode should be 0 here.
121 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_single_primary_mode]" = 0;
122 --source include/assert.inc
123
124 --source include/start_group_replication.inc
125
126 --let $assert_text= The super_read_only mode should be 1 here.
127 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0;
128 --source include/assert.inc
129
130 --let $rpl_group_replication_reset_persistent_vars=1
131 --source include/group_replication_end.inc