Debian Codegraph @

mysql-test/suite/group_replication/r/gr_json_array_unique_key_conflict.result

raw
1 include/group_replication.inc
2 Warnings:
3 Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4 Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
5 [connection server1]
6
7 ############################################################
8 # Create a table on server1.
9 [connection server1]
10 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, data JSON,
11 UNIQUE KEY zips((CAST(CAST(data AS JSON) AS UNSIGNED ARRAY))));
12 INSERT INTO t1(c1,data) VALUES (1,'[0,1,2]');
13 INSERT INTO t1(c1,data) VALUES (2,'[100,101]');
14 include/rpl_sync.inc
15
16 ############################################################
17 # Checking the conflict case.
18
19 ############################################################
20 # 0. Initial setup and checks.
21 [connection server1]
22 SET SESSION sql_log_bin= 0;
23 include/gtid_utils.inc
24 SET SESSION sql_log_bin= 1;
25 include/gtid_step_reset.inc
26
27 ############################################################
28 # 1. Set a debug sync before broadcast message to group on
29 # connection local_server_connection1.
30 [connection server1]
31 SET @debug_save= @@GLOBAL.DEBUG;
32 SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast';
33
34 #####################################################################
35 # 2. Commit local_transaction that will be blocked before broadcast.
36 BEGIN;
37 UPDATE t1 SET data = '[6,7,8]' WHERE JSON_CONTAINS(CAST(data AS JSON),'1');
38 COMMIT;
39
40 ############################################################
41 # 3. Wait until local transaction reaches the
42 # group_replication_before_message_broadcast debug sync point.
43 [connection server_1]
44
45 ############################################################
46 # 4. Execute a transaction on remote server, that will reach first
47 # certification, since transaction on the local server
48 # is blocked before broadcast.
49 [connection server2]
50 BEGIN;
51 UPDATE t1 SET data = '[3,4,5]' WHERE JSON_CONTAINS(CAST(data AS JSON),'1');
52 COMMIT;
53
54 ############################################################
55 # 5. Signal the waiting thread on local server to resume the
56 # transaction.
57 [connection server_1]
58 SET DEBUG_SYNC='now SIGNAL waiting';
59 SET @@GLOBAL.DEBUG= @debug_save;
60
61 ############################################################
62 # 6. Wait for remote transaction to be executed succesfully
63 on local server.
64 [connection server2]
65 include/sync_slave_sql_with_master.inc
66 ############################################################
67 # 7. If the test case is conflict scenario, local transaction
68 # will end up in an error stating that it was aborted,
69 # since transactions are conflicting and transaction on
70 # remote server was ordered first. If the test case is
71 # is positive scenario, no error will be seen here.
72 [connection server1]
73 ERROR 40000: Plugin instructed the server to rollback the current transaction.
74 [connection server1]
75 SET @@GLOBAL.DEBUG=@debug_save;
76 ############################################################
77 # 8. Sync everything
78 include/rpl_sync.inc
79 ############################################################
80 # 9. Assert that number of certified transactions are the
81 # expected ones.
82 include/assert.inc [The value of Count_Transactions_Checked should be 5 after starting group replication]
83 include/assert.inc [The value of Count_Conflicts_Detected should be 1 after starting group replication]
84 ############################################################
85 # 10. Assert that GTID is increased as expected
86 include/gtid_step_assert.inc [count=1, only_count=1]
87 [connection server1]
88 SET SESSION sql_log_bin= 0;
89 include/gtid_utils_end.inc
90 SET SESSION sql_log_bin= 1;
91 ############################################################
92 # 11. Cleanup (restore the connection back to original)
93 [connection server1]
94
95 ############################################################
96 # Checking the conflict case.
97
98 ############################################################
99 # 0. Initial setup and checks.
100 [connection server1]
101 SET SESSION sql_log_bin= 0;
102 include/gtid_utils.inc
103 SET SESSION sql_log_bin= 1;
104 include/gtid_step_reset.inc
105
106 ############################################################
107 # 1. Set a debug sync before broadcast message to group on
108 # connection local_server_connection1.
109 [connection server1]
110 SET @debug_save= @@GLOBAL.DEBUG;
111 SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast';
112
113 #####################################################################
114 # 2. Commit local_transaction that will be blocked before broadcast.
115 BEGIN;
116 INSERT INTO t1(c1,data) VALUES (4,'[13,14]');;
117 COMMIT;
118
119 ############################################################
120 # 3. Wait until local transaction reaches the
121 # group_replication_before_message_broadcast debug sync point.
122 [connection server_1]
123
124 ############################################################
125 # 4. Execute a transaction on remote server, that will reach first
126 # certification, since transaction on the local server
127 # is blocked before broadcast.
128 [connection server2]
129 BEGIN;
130 INSERT INTO t1(c1,data) VALUES (3,'[12,13]');;
131 COMMIT;
132
133 ############################################################
134 # 5. Signal the waiting thread on local server to resume the
135 # transaction.
136 [connection server_1]
137 SET DEBUG_SYNC='now SIGNAL waiting';
138 SET @@GLOBAL.DEBUG= @debug_save;
139
140 ############################################################
141 # 6. Wait for remote transaction to be executed succesfully
142 on local server.
143 [connection server2]
144 include/sync_slave_sql_with_master.inc
145 ############################################################
146 # 7. If the test case is conflict scenario, local transaction
147 # will end up in an error stating that it was aborted,
148 # since transactions are conflicting and transaction on
149 # remote server was ordered first. If the test case is
150 # is positive scenario, no error will be seen here.
151 [connection server1]
152 ERROR 40000: Plugin instructed the server to rollback the current transaction.
153 [connection server1]
154 SET @@GLOBAL.DEBUG=@debug_save;
155 ############################################################
156 # 8. Sync everything
157 include/rpl_sync.inc
158 ############################################################
159 # 9. Assert that number of certified transactions are the
160 # expected ones.
161 include/assert.inc [The value of Count_Transactions_Checked should be 7 after starting group replication]
162 include/assert.inc [The value of Count_Conflicts_Detected should be 2 after starting group replication]
163 ############################################################
164 # 10. Assert that GTID is increased as expected
165 include/gtid_step_assert.inc [count=1, only_count=1]
166 [connection server1]
167 SET SESSION sql_log_bin= 0;
168 include/gtid_utils_end.inc
169 SET SESSION sql_log_bin= 1;
170 ############################################################
171 # 11. Cleanup (restore the connection back to original)
172 [connection server1]
173
174 ############################################################
175 # Checking the positive case in which there is no conflict.
176
177 ############################################################
178 # 0. Initial setup and checks.
179 [connection server1]
180 SET SESSION sql_log_bin= 0;
181 include/gtid_utils.inc
182 SET SESSION sql_log_bin= 1;
183 include/gtid_step_reset.inc
184
185 ############################################################
186 # 1. Set a debug sync before broadcast message to group on
187 # connection local_server_connection1.
188 [connection server1]
189 SET @debug_save= @@GLOBAL.DEBUG;
190 SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast';
191
192 #####################################################################
193 # 2. Commit local_transaction that will be blocked before broadcast.
194 BEGIN;
195 UPDATE t1 SET data = '[10,11]' WHERE JSON_CONTAINS(CAST(data AS JSON),'100');
196 COMMIT;
197
198 ############################################################
199 # 3. Wait until local transaction reaches the
200 # group_replication_before_message_broadcast debug sync point.
201 [connection server_1]
202
203 ############################################################
204 # 4. Execute a transaction on remote server, that will reach first
205 # certification, since transaction on the local server
206 # is blocked before broadcast.
207 [connection server2]
208 BEGIN;
209 UPDATE t1 SET data = '[9]' WHERE JSON_CONTAINS(CAST(data AS JSON),'3');
210 COMMIT;
211
212 ############################################################
213 # 5. Signal the waiting thread on local server to resume the
214 # transaction.
215 [connection server_1]
216 SET DEBUG_SYNC='now SIGNAL waiting';
217 SET @@GLOBAL.DEBUG= @debug_save;
218
219 ############################################################
220 # 6. Wait for remote transaction to be executed succesfully
221 on local server.
222 [connection server2]
223 include/sync_slave_sql_with_master.inc
224 ############################################################
225 # 7. If the test case is conflict scenario, local transaction
226 # will end up in an error stating that it was aborted,
227 # since transactions are conflicting and transaction on
228 # remote server was ordered first. If the test case is
229 # is positive scenario, no error will be seen here.
230 [connection server1]
231 [connection server1]
232 SET @@GLOBAL.DEBUG=@debug_save;
233 ############################################################
234 # 8. Sync everything
235 include/rpl_sync.inc
236 ############################################################
237 # 9. Assert that number of certified transactions are the
238 # expected ones.
239 include/assert.inc [The value of Count_Transactions_Checked should be 9 after starting group replication]
240 include/assert.inc [The value of Count_Conflicts_Detected should be 2 after starting group replication]
241 ############################################################
242 # 10. Assert that GTID is increased as expected
243 include/gtid_step_assert.inc [count=2, only_count=1]
244 [connection server1]
245 SET SESSION sql_log_bin= 0;
246 include/gtid_utils_end.inc
247 SET SESSION sql_log_bin= 1;
248 ############################################################
249 # 11. Cleanup (restore the connection back to original)
250 [connection server1]
251
252 ############################################################
253 # Checking the positive case in which there is no conflict.
254
255 ############################################################
256 # 0. Initial setup and checks.
257 [connection server1]
258 SET SESSION sql_log_bin= 0;
259 include/gtid_utils.inc
260 SET SESSION sql_log_bin= 1;
261 include/gtid_step_reset.inc
262
263 ############################################################
264 # 1. Set a debug sync before broadcast message to group on
265 # connection local_server_connection1.
266 [connection server1]
267 SET @debug_save= @@GLOBAL.DEBUG;
268 SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast';
269
270 #####################################################################
271 # 2. Commit local_transaction that will be blocked before broadcast.
272 BEGIN;
273 INSERT INTO t1(c1,data) VALUES (4,NULL);;
274 COMMIT;
275
276 ############################################################
277 # 3. Wait until local transaction reaches the
278 # group_replication_before_message_broadcast debug sync point.
279 [connection server_1]
280
281 ############################################################
282 # 4. Execute a transaction on remote server, that will reach first
283 # certification, since transaction on the local server
284 # is blocked before broadcast.
285 [connection server2]
286 BEGIN;
287 INSERT INTO t1(c1,data) VALUES (5,NULL);;
288 COMMIT;
289
290 ############################################################
291 # 5. Signal the waiting thread on local server to resume the
292 # transaction.
293 [connection server_1]
294 SET DEBUG_SYNC='now SIGNAL waiting';
295 SET @@GLOBAL.DEBUG= @debug_save;
296
297 ############################################################
298 # 6. Wait for remote transaction to be executed succesfully
299 on local server.
300 [connection server2]
301 include/sync_slave_sql_with_master.inc
302 ############################################################
303 # 7. If the test case is conflict scenario, local transaction
304 # will end up in an error stating that it was aborted,
305 # since transactions are conflicting and transaction on
306 # remote server was ordered first. If the test case is
307 # is positive scenario, no error will be seen here.
308 [connection server1]
309 [connection server1]
310 SET @@GLOBAL.DEBUG=@debug_save;
311 ############################################################
312 # 8. Sync everything
313 include/rpl_sync.inc
314 ############################################################
315 # 9. Assert that number of certified transactions are the
316 # expected ones.
317 include/assert.inc [The value of Count_Transactions_Checked should be 11 after starting group replication]
318 include/assert.inc [The value of Count_Conflicts_Detected should be 2 after starting group replication]
319 ############################################################
320 # 10. Assert that GTID is increased as expected
321 include/gtid_step_assert.inc [count=2, only_count=1]
322 [connection server1]
323 SET SESSION sql_log_bin= 0;
324 include/gtid_utils_end.inc
325 SET SESSION sql_log_bin= 1;
326 ############################################################
327 # 11. Cleanup (restore the connection back to original)
328 [connection server1]
329
330 ############################################################
331 # Check the data sanity
332 [connection server1]
333 include/assert.inc [Table t1 will contain 2 rows after the above execution]
334 include/assert.inc [Table t1 will contain row after the above execution]
335 include/assert.inc [Table t1 will contain row after the above execution]
336 include/assert.inc [Table t1 will contain row after the above execution]
337 include/assert.inc [Table t1 will contain row after the above execution]
338 include/assert.inc [Table t1 will contain row after the above execution]
339 SELECT * FROM t1;
340 c1 data
341 1 [9]
342 2 [10, 11]
343 3 [12, 13]
344 4 NULL
345 5 NULL
346 include/diff_tables.inc [server1:t1, server2:t1]
347
348 ############################################################
349 # Clean up.
350 DROP TABLE t1;
351 include/group_replication_end.inc