@@ -7,389 +7,6 @@ connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
7
7
connection node_1b;
8
8
SET SESSION wsrep_sync_wait=0;
9
9
######################################################################
10
- # Test for OPTIMIZE
11
- ######################################################################
12
- ######################################################################
13
- #
14
- # Scenario #1: DML working on FK parent table BF aborted by DDL
15
- # over child table
16
- #
17
- ######################################################################
18
- connection node_1;
19
- SET SESSION wsrep_sync_wait=0;
20
- CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30));
21
- INSERT INTO p1 VALUES (1, 'INITIAL VALUE');
22
- CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30));
23
- INSERT INTO p2 VALUES (1, 'INITIAL VALUE');
24
- INSERT INTO p2 VALUES (2, 'INITIAL VALUE');
25
- CREATE TABLE c1 (pk INTEGER PRIMARY KEY, fk INTEGER, FOREIGN KEY (fk) REFERENCES p1(pk));
26
- INSERT INTO c1 VALUES (1,1);
27
- CREATE TABLE c2 (pk INTEGER PRIMARY KEY, fk1 INTEGER, fk2 INTEGER, FOREIGN KEY (fk1) REFERENCES p1(pk), FOREIGN KEY (fk2) REFERENCES p2(pk));
28
- INSERT INTO c2 VALUES (1,1,1), (2,1,2);
29
- connection node_1;
30
- SET AUTOCOMMIT=ON;
31
- START TRANSACTION;
32
- UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
33
- connection node_2;
34
- SET SESSION wsrep_sync_wait=0;
35
- OPTIMIZE TABLE c1 ;
36
- Table Op Msg_type Msg_text
37
- test.c1 optimize note Table does not support optimize, doing recreate + analyze instead
38
- test.c1 optimize status OK
39
- connection node_1;
40
- COMMIT;
41
- ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
42
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
43
- EXPECT_1
44
- 1
45
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
46
- EXPECT_2
47
- 2
48
- connection node_2;
49
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
50
- EXPECT_1
51
- 1
52
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
53
- EXPECT_2
54
- 2
55
- ######################################################################
56
- #
57
- # Scenario #2: DML working on FK parent table tries to replicate, but
58
- # fails in certification for earlier DDL on child table
59
- #
60
- ######################################################################
61
- connection node_1;
62
- BEGIN;
63
- SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
64
- connection node_2;
65
- OPTIMIZE TABLE c1 ;
66
- Table Op Msg_type Msg_text
67
- test.c1 optimize note Table does not support optimize, doing recreate + analyze instead
68
- test.c1 optimize status OK
69
- connection node_1a;
70
- SET SESSION wsrep_on = 0;
71
- SET SESSION wsrep_on = 1;
72
- SET GLOBAL wsrep_provider_options = 'dbug=';
73
- connection node_1;
74
- UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
75
- COMMIT;
76
- connection node_1a;
77
- SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
78
- connection node_1;
79
- ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
80
- SELECT 'I deadlocked';
81
- I deadlocked
82
- I deadlocked
83
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
84
- EXPECT_1
85
- 1
86
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
87
- EXPECT_2
88
- 2
89
- connection node_2;
90
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
91
- EXPECT_1
92
- 1
93
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
94
- EXPECT_2
95
- 2
96
- ######################################################################
97
- #
98
- # Scenario #3: 2 DMLs working on two FK parent tables try to replicate,
99
- # but fails in certification for earlier DDL on child table
100
- # which is child to both FK parents
101
- #
102
- ######################################################################
103
- connection node_1;
104
- BEGIN;
105
- connection node_1b;
106
- BEGIN;
107
- connection node_1a;
108
- SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
109
- connection node_2;
110
- OPTIMIZE TABLE c2 ;
111
- Table Op Msg_type Msg_text
112
- test.c2 optimize note Table does not support optimize, doing recreate + analyze instead
113
- test.c2 optimize status OK
114
- connection node_1a;
115
- SET SESSION wsrep_on = 0;
116
- SET SESSION wsrep_on = 1;
117
- SET GLOBAL wsrep_provider_options = 'dbug=';
118
- connection node_1;
119
- UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
120
- COMMIT;
121
- connection node_1b;
122
- UPDATE p2 SET f2 = 'TO DEADLOCK' WHERE pk = 2;
123
- COMMIT;
124
- connection node_1a;
125
- SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
126
- connection node_1;
127
- ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
128
- SELECT 'I deadlocked';
129
- I deadlocked
130
- I deadlocked
131
- connection node_1b;
132
- ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
133
- SELECT 'I deadlocked';
134
- I deadlocked
135
- I deadlocked
136
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
137
- EXPECT_1
138
- 1
139
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
140
- EXPECT_2
141
- 2
142
- connection node_2;
143
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
144
- EXPECT_1
145
- 1
146
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
147
- EXPECT_2
148
- 2
149
- DROP TABLE c1, c2;
150
- DROP TABLE p1, p2;
151
- ######################################################################
152
- # Test for OPTIMIZE
153
- ######################################################################
154
- connection node_1;
155
- SET SESSION wsrep_sync_wait=0;
156
- CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30));
157
- INSERT INTO p1 VALUES (1, 'INITIAL VALUE');
158
- CREATE TABLE c1 (pk INTEGER PRIMARY KEY, fk INTEGER, FOREIGN KEY (fk) REFERENCES p1(pk));
159
- INSERT INTO c1 VALUES (1,1);
160
- ######################################################################
161
- #
162
- # Scenario #4: DML working on FK parent table tries to replicate, but
163
- # fails in certification for earlier DDL on child table
164
- # and another temporary table. TMP table should be skipped
165
- # but FK child table should be replicated with proper keys
166
- #
167
- ######################################################################
168
- connection node_1;
169
- BEGIN;
170
- SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
171
- connection node_2;
172
- CREATE TEMPORARY TABLE tmp (i int);
173
- OPTIMIZE TABLE c1, tmp ;
174
- Table Op Msg_type Msg_text
175
- test.c1 optimize note Table does not support optimize, doing recreate + analyze instead
176
- test.c1 optimize status OK
177
- test.tmp optimize note Table does not support optimize, doing recreate + analyze instead
178
- test.tmp optimize status OK
179
- DROP TABLE tmp;
180
- connection node_1a;
181
- SET SESSION wsrep_on = 0;
182
- SET SESSION wsrep_on = 1;
183
- SET GLOBAL wsrep_provider_options = 'dbug=';
184
- connection node_1;
185
- UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
186
- COMMIT;
187
- connection node_1a;
188
- SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
189
- connection node_1;
190
- ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
191
- SELECT 'I deadlocked';
192
- I deadlocked
193
- I deadlocked
194
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
195
- EXPECT_1
196
- 1
197
- connection node_2;
198
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
199
- EXPECT_1
200
- 1
201
- DROP TABLE c1;
202
- DROP TABLE p1;
203
- ######################################################################
204
- # Test for REPAIR
205
- ######################################################################
206
- ######################################################################
207
- #
208
- # Scenario #1: DML working on FK parent table BF aborted by DDL
209
- # over child table
210
- #
211
- ######################################################################
212
- connection node_1;
213
- SET SESSION wsrep_sync_wait=0;
214
- CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30));
215
- INSERT INTO p1 VALUES (1, 'INITIAL VALUE');
216
- CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30));
217
- INSERT INTO p2 VALUES (1, 'INITIAL VALUE');
218
- INSERT INTO p2 VALUES (2, 'INITIAL VALUE');
219
- CREATE TABLE c1 (pk INTEGER PRIMARY KEY, fk INTEGER, FOREIGN KEY (fk) REFERENCES p1(pk));
220
- INSERT INTO c1 VALUES (1,1);
221
- CREATE TABLE c2 (pk INTEGER PRIMARY KEY, fk1 INTEGER, fk2 INTEGER, FOREIGN KEY (fk1) REFERENCES p1(pk), FOREIGN KEY (fk2) REFERENCES p2(pk));
222
- INSERT INTO c2 VALUES (1,1,1), (2,1,2);
223
- connection node_1;
224
- SET AUTOCOMMIT=ON;
225
- START TRANSACTION;
226
- UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
227
- connection node_2;
228
- SET SESSION wsrep_sync_wait=0;
229
- REPAIR TABLE c1 ;
230
- Table Op Msg_type Msg_text
231
- test.c1 repair note The storage engine for the table doesn't support repair
232
- connection node_1;
233
- COMMIT;
234
- ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
235
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
236
- EXPECT_1
237
- 1
238
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
239
- EXPECT_2
240
- 2
241
- connection node_2;
242
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
243
- EXPECT_1
244
- 1
245
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
246
- EXPECT_2
247
- 2
248
- ######################################################################
249
- #
250
- # Scenario #2: DML working on FK parent table tries to replicate, but
251
- # fails in certification for earlier DDL on child table
252
- #
253
- ######################################################################
254
- connection node_1;
255
- BEGIN;
256
- SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
257
- connection node_2;
258
- REPAIR TABLE c1 ;
259
- Table Op Msg_type Msg_text
260
- test.c1 repair note The storage engine for the table doesn't support repair
261
- connection node_1a;
262
- SET SESSION wsrep_on = 0;
263
- SET SESSION wsrep_on = 1;
264
- SET GLOBAL wsrep_provider_options = 'dbug=';
265
- connection node_1;
266
- UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
267
- COMMIT;
268
- connection node_1a;
269
- SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
270
- connection node_1;
271
- ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
272
- SELECT 'I deadlocked';
273
- I deadlocked
274
- I deadlocked
275
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
276
- EXPECT_1
277
- 1
278
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
279
- EXPECT_2
280
- 2
281
- connection node_2;
282
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
283
- EXPECT_1
284
- 1
285
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
286
- EXPECT_2
287
- 2
288
- ######################################################################
289
- #
290
- # Scenario #3: 2 DMLs working on two FK parent tables try to replicate,
291
- # but fails in certification for earlier DDL on child table
292
- # which is child to both FK parents
293
- #
294
- ######################################################################
295
- connection node_1;
296
- BEGIN;
297
- connection node_1b;
298
- BEGIN;
299
- connection node_1a;
300
- SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
301
- connection node_2;
302
- REPAIR TABLE c2 ;
303
- Table Op Msg_type Msg_text
304
- test.c2 repair note The storage engine for the table doesn't support repair
305
- connection node_1a;
306
- SET SESSION wsrep_on = 0;
307
- SET SESSION wsrep_on = 1;
308
- SET GLOBAL wsrep_provider_options = 'dbug=';
309
- connection node_1;
310
- UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
311
- COMMIT;
312
- connection node_1b;
313
- UPDATE p2 SET f2 = 'TO DEADLOCK' WHERE pk = 2;
314
- COMMIT;
315
- connection node_1a;
316
- SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
317
- connection node_1;
318
- ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
319
- SELECT 'I deadlocked';
320
- I deadlocked
321
- I deadlocked
322
- connection node_1b;
323
- ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
324
- SELECT 'I deadlocked';
325
- I deadlocked
326
- I deadlocked
327
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
328
- EXPECT_1
329
- 1
330
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
331
- EXPECT_2
332
- 2
333
- connection node_2;
334
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
335
- EXPECT_1
336
- 1
337
- SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
338
- EXPECT_2
339
- 2
340
- DROP TABLE c1, c2;
341
- DROP TABLE p1, p2;
342
- ######################################################################
343
- # Test for REPAIR
344
- ######################################################################
345
- connection node_1;
346
- SET SESSION wsrep_sync_wait=0;
347
- CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30));
348
- INSERT INTO p1 VALUES (1, 'INITIAL VALUE');
349
- CREATE TABLE c1 (pk INTEGER PRIMARY KEY, fk INTEGER, FOREIGN KEY (fk) REFERENCES p1(pk));
350
- INSERT INTO c1 VALUES (1,1);
351
- ######################################################################
352
- #
353
- # Scenario #4: DML working on FK parent table tries to replicate, but
354
- # fails in certification for earlier DDL on child table
355
- # and another temporary table. TMP table should be skipped
356
- # but FK child table should be replicated with proper keys
357
- #
358
- ######################################################################
359
- connection node_1;
360
- BEGIN;
361
- SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
362
- connection node_2;
363
- CREATE TEMPORARY TABLE tmp (i int);
364
- REPAIR TABLE c1, tmp ;
365
- Table Op Msg_type Msg_text
366
- test.c1 repair note The storage engine for the table doesn't support repair
367
- test.tmp repair note The storage engine for the table doesn't support repair
368
- DROP TABLE tmp;
369
- connection node_1a;
370
- SET SESSION wsrep_on = 0;
371
- SET SESSION wsrep_on = 1;
372
- SET GLOBAL wsrep_provider_options = 'dbug=';
373
- connection node_1;
374
- UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
375
- COMMIT;
376
- connection node_1a;
377
- SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
378
- connection node_1;
379
- ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
380
- SELECT 'I deadlocked';
381
- I deadlocked
382
- I deadlocked
383
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
384
- EXPECT_1
385
- 1
386
- connection node_2;
387
- SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
388
- EXPECT_1
389
- 1
390
- DROP TABLE c1;
391
- DROP TABLE p1;
392
- ######################################################################
393
10
# Test for ALTER ENGINE=INNODB
394
11
######################################################################
395
12
######################################################################
0 commit comments