Debian Codegraph @

mysql-test/suite/ndb/t/ndb_limit_deferred_triggers.test

raw
1 ### This test checks whether limiting the number of ###
2 ### concurrent triggers being executed is correct ###
3 ### and it eases the resource usage like job buffer ###
4
5 -- source include/have_ndb.inc
6
7 ### Test limiting deferred parent key checking by: ###
8 ### Updating child table having FK constraints ###
9
10 # Server that create tables and fill them
11 connect (ddl,localhost,root,,test);
12
13 # Servers provoke trigger handling
14 connect (s2,localhost,root,,test);
15 connect (s3,localhost,root,,test);
16
17 connection ddl;
18
19 --disable_warnings
20 drop table if exists parentt1, childt2, childt3;
21 --enable_warnings
22
23 create table parentt1(
24 a int not null,
25 b int not null,
26 c int not null,
27 unique key uk13(c)
28 )engine=ndb;
29
30 create table childt2(
31 a int,
32 b int,
33 c int,
34 d int,
35 e int,
36 foreign key fk21(a) references parentt1(c),
37 foreign key fk22(b) references parentt1(c),
38 foreign key fk23(c) references parentt1(c),
39 foreign key fk24(d) references parentt1(c),
40 foreign key fk25(e) references parentt1(c)
41 )engine=ndb;
42
43 create table childt3(
44 a int,
45 b int,
46 c int,
47 d int,
48 e int,
49 foreign key fk31(a) references parentt1(c),
50 foreign key fk32(b) references parentt1(c),
51 foreign key fk33(c) references parentt1(c),
52 foreign key fk34(d) references parentt1(c),
53 foreign key fk35(e) references parentt1(c)
54 )engine=ndb;
55
56
57 # Fill the parent table
58
59 let $max_rows = 10000;
60
61 --disable_query_log
62 let $loops = $max_rows;
63
64 while ($loops)
65 {
66 eval insert into parentt1 values ($loops, $loops, $loops);
67 dec $loops;
68 }
69
70
71 # Fill the child tables
72 let $loops = $max_rows;
73 while ($loops)
74 {
75 eval insert into childt2 values ($loops, $loops, $loops, $loops, $loops);
76 eval insert into childt3 values ($loops, $loops, $loops, $loops, $loops);
77 dec $loops;
78 }
79 --enable_query_log
80
81 # Update the children such that the updated value will be checked against
82 # the parent table, as a deferred trigger.
83 # Provoke a high load on job buffer
84
85 let $query2 = update childt2 set a=$max_rows, b=$max_rows, c=$max_rows, d=$max_rows, e=$max_rows;
86 let $query3 = update childt3 set a=$max_rows, b=$max_rows, c=$max_rows, d=$max_rows, e=$max_rows;
87
88 connection s2;
89 send_eval $query2;
90
91 connection s3;
92 send_eval $query3;
93
94 connection s2;
95 --reap
96
97 connection s3;
98 --reap
99
100 # Cleanup
101 # Key constraints are dropped automatically when child tables are dropped
102 drop table childt2, childt3;
103 # Drop parent table
104 drop table parentt1;