File: galera_multi_level_fk_ddl_update.result

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (358 lines) | stat: -rw-r--r-- 9,391 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
connection node_2;
connection node_1;
#
# 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and UPDATE on t1
#    with foreign key references as below:
#    - t1<-t2<-t3<-t4
#    - t3<-t5
#    - t2<-t6
#
connection node_2;
SET GLOBAL wsrep_slave_threads=2;
CREATE TABLE t1 (
id INTEGER PRIMARY KEY,
f2 INTEGER
);
CREATE TABLE t2 (
id INT PRIMARY KEY,
t1_id INT NOT NULL,
t5_id INT NOT NULL,
f2 INTEGER NOT NULL,
KEY key_t1_id(t1_id),
CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE,
KEY key_t5_id(t5_id)
);
CREATE TABLE t3 (
id INT PRIMARY KEY,
t2_id INT NOT NULL,
f2 INTEGER NOT NULL,
KEY key_t2_id(t2_id),
CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE
);
CREATE TABLE t4 (
id INT PRIMARY KEY,
t3_id INT NOT NULL,
f2 INTEGER NOT NULL,
KEY key_t3_id(t3_id),
CONSTRAINT key_t3_id FOREIGN KEY (t3_id) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE
);
CREATE TABLE t5 (
id INT PRIMARY KEY,
t3_id_1 INT NOT NULL,
f2 INTEGER NOT NULL,
KEY key_t3_id_1(t3_id_1),
CONSTRAINT key_t3_id_1 FOREIGN KEY (t3_id_1) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE
);
CREATE TABLE t6 (
id INT PRIMARY KEY,
t2_id INT NOT NULL,
f2 INTEGER NOT NULL,
KEY key_t2_id_1(t2_id),
CONSTRAINT key_t2_id_1 FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE
);
INSERT INTO t1 VALUES (1,0);
INSERT INTO t1 VALUES (2,0);
INSERT INTO t2 VALUES (1,1,1,1234);
INSERT INTO t2 VALUES (2,2,2,1234);
INSERT INTO t3 VALUES (1,1,1234);
INSERT INTO t3 VALUES (2,2,1234);
INSERT INTO t4 VALUES (1,1,1234);
INSERT INTO t4 VALUES (2,2,1234);
INSERT INTO t5 VALUES (1,1,1234);
INSERT INTO t5 VALUES (2,2,1234);
ALTER TABLE t2 ADD CONSTRAINT key_t5_id FOREIGN KEY (t5_id)
REFERENCES t5 (id) ON UPDATE CASCADE ON DELETE CASCADE;
connection node_1;
connection node_2;
SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi';
connection node_1;
DROP TABLE t6;
connection node_2;
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached";
SET SESSION wsrep_sync_wait = 0;
connection node_1;
SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table';
START TRANSACTION;
UPDATE t1 SET f2 = 1 WHERE id=2;
COMMIT;
connection node_2;
SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi';
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi";
SET DEBUG_SYNC = 'RESET';
SET GLOBAL DEBUG_DBUG = "";
SET GLOBAL wsrep_slave_threads=DEFAULT;
connection node_1;
SET DEBUG_SYNC = 'RESET';
SET GLOBAL DEBUG_DBUG = "";
SET GLOBAL wsrep_slave_threads=DEFAULT;
connection node_1;
include/assert_grep.inc [Foreign key referenced table found: 4 tables]
include/assert_grep.inc [Foreign key referenced table found: test.t2]
include/assert_grep.inc [Foreign key referenced table found: test.t3]
include/assert_grep.inc [Foreign key referenced table found: test.t4]
include/assert_grep.inc [Foreign key referenced table found: test.t5]
connection node_2;
select * from t1;
id	f2
1	0
2	1
select * from t2;
id	t1_id	t5_id	f2
1	1	1	1234
2	2	2	1234
select * from t3;
id	t2_id	f2
1	1	1234
2	2	1234
select * from t4;
id	t3_id	f2
1	1	1234
2	2	1234
select * from t5;
id	t3_id_1	f2
1	1	1234
2	2	1234
select * from t6;
ERROR 42S02: Table 'test.t6' doesn't exist
connection node_1;
select * from t1;
id	f2
1	0
2	1
select * from t2;
id	t1_id	t5_id	f2
1	1	1	1234
2	2	2	1234
select * from t3;
id	t2_id	f2
1	1	1234
2	2	1234
select * from t4;
id	t3_id	f2
1	1	1234
2	2	1234
select * from t5;
id	t3_id_1	f2
1	1	1234
2	2	1234
select * from t6;
ERROR 42S02: Table 'test.t6' doesn't exist
ALTER TABLE t2 DROP FOREIGN KEY key_t5_id;
DROP TABLE t5, t4, t3, t2, t1;
#
# 2. BF-BF conflict on MDL locks between:
#    ALTER TABLE t3 (whose parent table are t3 -> t2 -> t1), and
#    UPDATE on t1 with t2 referencing t1, and t3 referencing t2.
#
connection node_2;
SET GLOBAL wsrep_slave_threads=2;
CREATE TABLE t1 (
id INTEGER PRIMARY KEY,
f2 INTEGER
);
CREATE TABLE t2 (
id INT PRIMARY KEY,
t1_id INT NOT NULL,
f2 INTEGER NOT NULL,
KEY key_t1_id(t1_id),
CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE
);
CREATE TABLE t3 (
id INT PRIMARY KEY,
t2_id INT NOT NULL,
f2 INTEGER NOT NULL,
KEY key_t2_id(t2_id)
);
INSERT INTO t1 VALUES (1,0);
INSERT INTO t1 VALUES (2,0);
INSERT INTO t2 VALUES (1,1,1234);
INSERT INTO t2 VALUES (2,2,1234);
connection node_2;
SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi';
connection node_1;
ALTER TABLE t3 ADD CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE;
connection node_2;
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached";
SET SESSION wsrep_sync_wait = 0;
connection node_1;
SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table';
START TRANSACTION;
UPDATE t1 SET f2 = 1 WHERE id=2;
COMMIT;
connection node_2;
SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi';
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi";
SET DEBUG_SYNC = 'RESET';
SET GLOBAL DEBUG_DBUG = "";
SET GLOBAL wsrep_slave_threads=DEFAULT;
connection node_1;
SET DEBUG_SYNC = 'RESET';
SET GLOBAL DEBUG_DBUG = "";
SET GLOBAL wsrep_slave_threads=DEFAULT;
connection node_1;
include/assert_grep.inc [Foreign key referenced table found: 2 tables]
include/assert_grep.inc [Foreign key referenced table found: test.t2]
include/assert_grep.inc [Foreign key referenced table found: test.t3]
connection node_2;
select * from t1;
id	f2
1	0
2	1
select * from t2;
id	t1_id	f2
1	1	1234
2	2	1234
select * from t3;
id	t2_id	f2
connection node_1;
select * from t1;
id	f2
1	0
2	1
select * from t2;
id	t1_id	f2
1	1	1234
2	2	1234
select * from t3;
id	t2_id	f2
DROP TABLE t3, t2, t1;
#
# 3. BF-BF conflict on MDL locks between:
#    CREATE TABLE t3 (whose parent table are t3 -> t2 -> t1), and
#    UPDATE on t1 with t2 referencing t1, and t3 referencing t2.
#
connection node_2;
SET GLOBAL wsrep_slave_threads=2;
CREATE TABLE t1 (
id INTEGER PRIMARY KEY,
f2 INTEGER
);
CREATE TABLE t2 (
id INT PRIMARY KEY,
t1_id INT NOT NULL,
f2 INTEGER NOT NULL,
KEY key_t1_id(t1_id),
CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE
);
INSERT INTO t1 VALUES (1,0);
INSERT INTO t1 VALUES (2,0);
INSERT INTO t2 VALUES (1,1,1234);
INSERT INTO t2 VALUES (2,2,1234);
connection node_2;
SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi';
connection node_1;
CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT NOT NULL, f2 INTEGER NOT NULL, KEY key_t2_id(t2_id), CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE);
connection node_2;
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached";
SET SESSION wsrep_sync_wait = 0;
connection node_1;
SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table';
START TRANSACTION;
UPDATE t1 SET f2 = 1 WHERE id=2;
COMMIT;
connection node_2;
SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi';
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi";
SET DEBUG_SYNC = 'RESET';
SET GLOBAL DEBUG_DBUG = "";
SET GLOBAL wsrep_slave_threads=DEFAULT;
connection node_1;
SET DEBUG_SYNC = 'RESET';
SET GLOBAL DEBUG_DBUG = "";
SET GLOBAL wsrep_slave_threads=DEFAULT;
connection node_1;
include/assert_grep.inc [Foreign key referenced table found: 2 tables]
include/assert_grep.inc [Foreign key referenced table found: test.t2]
include/assert_grep.inc [Foreign key referenced table found: test.t3]
connection node_2;
select * from t1;
id	f2
1	0
2	1
select * from t2;
id	t1_id	f2
1	1	1234
2	2	1234
select * from t3;
id	t2_id	f2
connection node_1;
select * from t1;
id	f2
1	0
2	1
select * from t2;
id	t1_id	f2
1	1	1234
2	2	1234
select * from t3;
id	t2_id	f2
DROP TABLE t3, t2, t1;
#
# 4. BF-BF conflict on MDL locks between:
#    OPTIMIZE TABLE t2 (whose parent table are t2 -> t1), and
#    UPDATE on t1.
#
connection node_2;
SET GLOBAL wsrep_slave_threads=2;
CREATE TABLE t1 (
id INTEGER PRIMARY KEY,
f2 INTEGER
);
CREATE TABLE t2 (
id INT PRIMARY KEY,
t1_id INT NOT NULL,
f2 INTEGER NOT NULL,
KEY key_t1_id(t1_id),
CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE
);
INSERT INTO t1 VALUES (1,0);
INSERT INTO t1 VALUES (2,0);
INSERT INTO t2 VALUES (1,1,1234);
INSERT INTO t2 VALUES (2,2,1234);
connection node_2;
SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi';
connection node_1;
OPTIMIZE TABLE t2;
Table	Op	Msg_type	Msg_text
test.t2	optimize	note	Table does not support optimize, doing recreate + analyze instead
test.t2	optimize	status	OK
connection node_2;
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached";
SET SESSION wsrep_sync_wait = 0;
connection node_1;
SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table';
START TRANSACTION;
UPDATE t1 SET f2 = 1 WHERE id=2;
COMMIT;
connection node_2;
SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi';
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi";
SET DEBUG_SYNC = 'RESET';
SET GLOBAL DEBUG_DBUG = "";
SET GLOBAL wsrep_slave_threads=DEFAULT;
connection node_1;
SET DEBUG_SYNC = 'RESET';
SET GLOBAL DEBUG_DBUG = "";
SET GLOBAL wsrep_slave_threads=DEFAULT;
connection node_1;
include/assert_grep.inc [Foreign key referenced table found: 1 tables]
include/assert_grep.inc [Foreign key referenced table found: test.t2]
connection node_2;
select * from t1;
id	f2
1	0
2	1
select * from t2;
id	t1_id	f2
1	1	1234
2	2	1234
connection node_1;
select * from t1;
id	f2
1	0
2	1
select * from t2;
id	t1_id	f2
1	1	1234
2	2	1234
DROP TABLE t2, t1;