Debian Codegraph @

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

raw
1 ################################################################################
2 # This test validates the functioning of the version handshake algorithm on
3 # group replication.
4 # The test makes the group go through several changes involving different member
5 # versions validating the expected outcome on each case.
6 # The test script is:
7 # *) The test requires five servers: S1, S2, S3, S4
8 #
9 # Server Step Version (to base) Outcome
10 #-------------------------------------------------------------------------------
11 # (S1) join member with a higher patch version* (patch version + 1) OK
12 # (S2) join member with a higher minor version (minor version + 1) OK
13 # (S3) join member with the base version (base version) Failure
14 # (S3) member leaves
15 # (S3) join member with a higher major version (major version +1) OK
16 # (S4) join member with a higher minor version (minor version + 1) OK
17 # (S1) member leaves
18 # (S1) join member with the base version (base version) Failure
19 #
20 # *) The group start happens with Server 1 joining
21 #
22 # The base version is version of the plugin associated with this test:
23 # Version= MAJOR.MINOR.PATCH
24 #
25 ################################################################################
26
27 --source include/not_valgrind.inc
28 --source include/big_test.inc
29 --source include/have_debug.inc
30 --let $group_replication_group_name= 8a1da670-05fa-11e5-b939-0800200c9a66
31 --source include/have_group_replication_plugin.inc
32 --let $rpl_skip_group_replication_start= 1
33 --let $rpl_server_count= 4
34 --source include/group_replication.inc
35
36 --echo #
37 --echo # Check the version of member 1 is fully visible in the plugin table
38 --echo #
39
40 --let $assert_text= The plugin major and minor versions are visible in the version column
41 --let $assert_cond= [SELECT COUNT(*) FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME= "group_replication" and PLUGIN_VERSION= "1.1" ] = 1;
42 --source include/assert.inc
43
44 --let $assert_text= The plugin total version can be seen in the description column
45 --let $assert_cond= [SELECT COUNT(*) FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME= "group_replication" and PLUGIN_DESCRIPTION= "Group Replication (1.1.0)" ] = 1;
46 --source include/assert.inc
47
48 --echo #
49 --echo # Setup a new member with version a higher patch version
50 --echo # Version= Base version + 1 patch version
51 --echo #
52
53 --connection server1
54 --echo server1
55
56 SET @debug_saved_s1= @@GLOBAL.DEBUG;
57 SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_patch_version';
58
59 --source include/start_and_bootstrap_group_replication.inc
60
61 # Add some data for recovery
62
63 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
64 INSERT INTO t1 VALUES (1);
65
66
67 --echo #
68 --echo # Try to add a new member with a higher minor version
69 --echo # Version = Base version + 1 minor version
70 --echo # The member will join the group
71 --echo #
72
73 --connection server2
74 --echo server2
75
76 SET @debug_saved_s2= @@GLOBAL.DEBUG;
77 # Cause the member to broadcast and compare himself using a higher version
78 SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_minor_version';
79
80 SET session sql_log_bin=0;
81 call mtr.add_suppression("Member version is read compatible with the group.");
82 SET session sql_log_bin=1;
83
84 --source include/start_group_replication.inc
85
86 # Check the data is there
87
88 --let $assert_text= On the recovered member, the table should contain 1 elements
89 --let $assert_cond= [SELECT COUNT(*) FROM t1] = 1;
90 --source include/assert.inc
91
92 --echo #
93 --echo # Try to add a new member with a base version.
94 --echo # Version = Base version
95 --echo # It will fail since group lowest version is (patch + 1)
96 --echo # Try to add server 3 again with higher major version.
97 --echo # Version= Base version + 1 major version
98 --echo # It will succeed and join group in read only mode.
99 --echo #
100
101 --connection server3
102 --echo server3
103
104 SET session sql_log_bin=0;
105 call mtr.add_suppression("Member version is incompatible with the group");
106 call mtr.add_suppression("Member version is read compatible with the group.");
107 SET session sql_log_bin=1;
108
109 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
110 --error ER_GROUP_REPLICATION_CONFIGURATION
111 START GROUP_REPLICATION;
112
113 # Cause the member to broadcast and compare himself using a higher version
114 SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_major_version';
115
116 --source include/start_group_replication.inc
117
118 # Check the data is there
119
120 --let $assert_text= On the recovered member, the table should contain 1 elements
121 --let $assert_cond= [SELECT COUNT(*) FROM t1] = 1;
122 --source include/assert.inc
123
124 --echo #
125 --echo # Try to add a new member with a major version equal to the base version,
126 --echo # but a higher minor version.
127 --echo # Version = Base version + 1 minor version
128 --echo #
129
130 --connection server4
131 --echo server4
132
133 SET @debug_saved_s4= @@GLOBAL.DEBUG;
134
135 SET session sql_log_bin=0;
136 call mtr.add_suppression("Member version is read compatible with the group.");
137 SET session sql_log_bin=1;
138
139 # Cause the member to broadcast and compare himself using a high version
140 SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_minor_version';
141 SET GLOBAL group_replication_group_name= "8a1da670-05fa-11e5-b939-0800200c9a66";
142
143 # Before < 8.0.16 this join used to fail because higher major version member is present i.e. S3 server
144 # Post 8.0.16 this will succeed, since comparison is done with only lowest version i.e. S1 in this scenario
145 # S4 is compatible since its greater then patch version present in group i.e. S1 server
146 --source include/start_group_replication.inc
147
148 # Check the data is there
149
150 --let $assert_text= On the recovered member, the table should contain 1 elements
151 --let $assert_cond= [SELECT COUNT(*) FROM t1] = 1;
152 --source include/assert.inc
153
154 --echo #
155 --echo # Stop GR on server 1 and start server 1 with base version.
156 --echo # Version = Base version
157 --echo # It will fail since group lowest version is (minor + 1)
158 --echo #
159
160 --connection server1
161 --echo server1
162
163 # DROP table now, else we will have to start all servers for cleanup
164 DROP TABLE t1;
165 --source include/rpl_sync.inc
166
167 --source include/stop_group_replication.inc
168
169 SET session sql_log_bin=0;
170 call mtr.add_suppression("Member version is incompatible with the group");
171 SET session sql_log_bin=1;
172
173 SET @@GLOBAL.DEBUG= @debug_save_s1;
174 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
175 --error ER_GROUP_REPLICATION_CONFIGURATION
176 START GROUP_REPLICATION;
177
178 --echo #
179 --echo # Clean up
180 --echo #
181
182 --connection server2
183 --echo server2
184
185 SET @@GLOBAL.DEBUG= @debug_save_s2;
186 --source include/stop_group_replication.inc
187
188 --connection server3
189 --echo server3
190
191 SET @@GLOBAL.DEBUG= @debug_save_s3;
192 --source include/stop_group_replication.inc
193
194 --connection server4
195 --echo server4
196
197 SET @@GLOBAL.DEBUG= @debug_save_s4;
198 --source include/stop_group_replication.inc
199
200
201 --source include/group_replication_end.inc