Debian Codegraph @

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

raw
1 ################################################################################
2 ## Server_uuid should not match with group_replication_group_name when GR is
3 ## running.
4 ##
5 ## This test case covers testing of server_uuid matching
6 ## group_replication_group_name when server start_on_boot=OFF.
7 ##
8 ## Test:
9 ## 0. This test requires 2 members.
10 ## 0.1. Store members uuids and set bin logs for required servers.
11 ## 1. Bootstrap server1 with server1_uuid as group_name
12 ## 1.1. START GROUP_REPLICATION should fail on server1.
13 ## Since server_uuid matches group_name GR should not start.
14 ## 1.2. Validate failure logged in error file.
15 ## 2. Bootstrap server1 with group_name as server2_UUID.
16 ## Environment setup required to match server2_UUID and group_name.
17 ## Server1 will work as seed.
18 ## 2.1. Assert GR starts on server1.
19 ## Since server_uuid does not match group_name GR should start.
20 ## 2.2. Start server2 with server2_uuid as group_name
21 ## 2.3. START GROUP_REPLICATION should fail on server2.
22 ## Since server_uuid matches group_name GR should not start.
23 ## 2.4. Validate failure logged in error file.
24 ## 3. Bootstrap server1 with unique group_name
25 ## 3.1. Start server2 with unique group_name
26 ## 3.2. Assert GR starts on server2.
27 ## Since server_uuid does not match group_name GR should start.
28 ## 4. Cleanup
29 ################################################################################
30
31 --source include/have_group_replication_plugin.inc
32 --let $rpl_skip_group_replication_start= 1
33 --source include/group_replication.inc
34
35 ## 0.1. Store members uuids and set bin logs for required servers.
36
37 ## Get server_uuid of server1
38 --let $rpl_connection_name= server1
39 --source include/rpl_connection.inc
40 --let $member1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
41
42 set session sql_log_bin=0;
43 call mtr.add_suppression("Member server_uuid is incompatible with the group.*");
44 set session sql_log_bin=1;
45
46 ## Get server_uuid of server2
47 --let $rpl_connection_name= server2
48 --source include/rpl_connection.inc
49 --let $member2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
50
51 set session sql_log_bin=0;
52 call mtr.add_suppression("Member server_uuid is incompatible with the group.*");
53 set session sql_log_bin=1;
54
55 --echo
56 --echo #######################
57 --echo ## BOOTSTRAP CASES ##
58 --echo #######################
59 --echo
60
61 ## 1. Bootstrap server1 with server1_uuid as group_name
62
63 --let $rpl_connection_name= server1
64 --source include/rpl_connection.inc
65
66 SET @debug_group_replication_start_on_boot= @@GLOBAL.group_replication_start_on_boot;
67
68 --disable_query_log
69 --eval SET GLOBAL group_replication_group_name = "$member1_uuid"
70 --eval SET GLOBAL group_replication_start_on_boot = ON;
71 --enable_query_log
72
73 ## 1.1. START GROUP_REPLICATION should fail on server1.
74 ## Since server_uuid matches group_name GR should not start.
75
76 --error ER_GROUP_REPLICATION_CONFIGURATION
77 START GROUP_REPLICATION;
78
79 ## 1.2. Validate failure logged in error file.
80
81 --let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_server_uuid_matches_group_name.1.err
82 --let $assert_text = Found the expected error about server_uuid incompatible with the group_name
83 --let $assert_select = Member server_uuid is incompatible with the group
84 --let $assert_count = 1
85 --source include/assert_grep.inc
86
87 --echo
88 --echo ###########################
89 --echo ## NON-BOOTSTRAP CASES ##
90 --echo ###########################
91 --echo
92
93 ## 2. Bootstrap server1 with group_name as server2_UUID.
94 ## Environment setup required to match server2_UUID and group_name.
95 ## Server1 will work as seed.
96
97 --let $group_replication_group_name= $member2_uuid
98 --source include/start_and_bootstrap_group_replication.inc
99
100 ## 2.1. Assert GR starts on server1.
101 ## Since server_uuid does not match group_name GR should start.
102
103 --let $assert_text= 'Assert server1 is ONLINE'
104 --let $assert_cond= "[SELECT COUNT(*) from performance_schema.replication_group_members WHERE MEMBER_STATE=\"ONLINE\"]" = 1
105 --source include/assert.inc
106
107 ## 2.2. Start server2 with server2_uuid as group_name
108
109 --let $rpl_connection_name= server2
110 --source include/rpl_connection.inc
111
112 --disable_query_log
113 --eval SET GLOBAL group_replication_group_name = "$member2_uuid";
114 --eval SET GLOBAL group_replication_start_on_boot = OFF;
115 --enable_query_log
116
117 ## 2.3. START GROUP_REPLICATION should fail on server2.
118 ## Since server_uuid matches group_name GR should not start.
119
120 --error ER_GROUP_REPLICATION_CONFIGURATION
121 START GROUP_REPLICATION;
122
123 ## 2.4. Validate failure logged in error file.
124
125 --let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_server_uuid_matches_group_name.2.err
126 --let $assert_text = Found the expected error about server_uuid incompatible with the group_name
127 --let $assert_select = Member server_uuid is incompatible with the group
128 --let $assert_count = 1
129 --source include/assert_grep.inc
130
131 --echo
132 --echo ########################
133 --echo ## SUCCESSFUL CASES ##
134 --echo ########################
135 --echo
136
137 ## 3. Bootstrap server1 with unique group_name
138
139 ## Reset configurations and start server1
140 --let $rpl_connection_name= server1
141 --source include/rpl_connection.inc
142
143 --source include/stop_group_replication.inc
144 SET @@GLOBAL.group_replication_start_on_boot= @debug_group_replication_start_on_boot;
145
146 --let $group_replication_group_name= 8a94f357-aaaa-11aa-22bb-c80aa9420000
147 --source include/start_and_bootstrap_group_replication.inc
148
149 ## 3.1. Start server2 with unique group_name
150
151 --let $rpl_connection_name= server2
152 --source include/rpl_connection.inc
153 --source include/start_group_replication.inc
154
155 ## 3.2. Assert GR starts on server2.
156 ## Since server_uuid does not match group_name GR should start.
157
158 --let $assert_text= 'Assert server 1 and server 2 are ONLINE'
159 --let $assert_cond= "[SELECT COUNT(*) from performance_schema.replication_group_members WHERE MEMBER_STATE=\"ONLINE\"]" = 2
160 --source include/assert.inc
161
162 --echo
163 --echo ###############
164 --echo ## Cleanup ##
165 --echo ###############
166 --echo
167
168 ## 4. Cleanup
169
170 --source include/group_replication_end.inc