105 lines
2.3 KiB
Plaintext
105 lines
2.3 KiB
Plaintext
### This test checks whether limiting the number of ###
|
|
### concurrent triggers being executed is correct ###
|
|
### and it eases the resource usage like job buffer ###
|
|
|
|
-- source include/have_ndb.inc
|
|
|
|
### Test limiting deferred parent key checking by: ###
|
|
### Updating child table having FK constraints ###
|
|
|
|
# Server that create tables and fill them
|
|
connect (ddl,localhost,root,,test);
|
|
|
|
# Servers provoke trigger handling
|
|
connect (s2,localhost,root,,test);
|
|
connect (s3,localhost,root,,test);
|
|
|
|
connection ddl;
|
|
|
|
--disable_warnings
|
|
drop table if exists parentt1, childt2, childt3;
|
|
--enable_warnings
|
|
|
|
create table parentt1(
|
|
a int not null,
|
|
b int not null,
|
|
c int not null,
|
|
unique key uk13(c)
|
|
)engine=ndb;
|
|
|
|
create table childt2(
|
|
a int,
|
|
b int,
|
|
c int,
|
|
d int,
|
|
e int,
|
|
foreign key fk21(a) references parentt1(c),
|
|
foreign key fk22(b) references parentt1(c),
|
|
foreign key fk23(c) references parentt1(c),
|
|
foreign key fk24(d) references parentt1(c),
|
|
foreign key fk25(e) references parentt1(c)
|
|
)engine=ndb;
|
|
|
|
create table childt3(
|
|
a int,
|
|
b int,
|
|
c int,
|
|
d int,
|
|
e int,
|
|
foreign key fk31(a) references parentt1(c),
|
|
foreign key fk32(b) references parentt1(c),
|
|
foreign key fk33(c) references parentt1(c),
|
|
foreign key fk34(d) references parentt1(c),
|
|
foreign key fk35(e) references parentt1(c)
|
|
)engine=ndb;
|
|
|
|
|
|
# Fill the parent table
|
|
|
|
let $max_rows = 10000;
|
|
|
|
--disable_query_log
|
|
let $loops = $max_rows;
|
|
|
|
while ($loops)
|
|
{
|
|
eval insert into parentt1 values ($loops, $loops, $loops);
|
|
dec $loops;
|
|
}
|
|
|
|
|
|
# Fill the child tables
|
|
let $loops = $max_rows;
|
|
while ($loops)
|
|
{
|
|
eval insert into childt2 values ($loops, $loops, $loops, $loops, $loops);
|
|
eval insert into childt3 values ($loops, $loops, $loops, $loops, $loops);
|
|
dec $loops;
|
|
}
|
|
--enable_query_log
|
|
|
|
# Update the children such that the updated value will be checked against
|
|
# the parent table, as a deferred trigger.
|
|
# Provoke a high load on job buffer
|
|
|
|
let $query2 = update childt2 set a=$max_rows, b=$max_rows, c=$max_rows, d=$max_rows, e=$max_rows;
|
|
let $query3 = update childt3 set a=$max_rows, b=$max_rows, c=$max_rows, d=$max_rows, e=$max_rows;
|
|
|
|
connection s2;
|
|
send_eval $query2;
|
|
|
|
connection s3;
|
|
send_eval $query3;
|
|
|
|
connection s2;
|
|
--reap
|
|
|
|
connection s3;
|
|
--reap
|
|
|
|
# Cleanup
|
|
# Key constraints are dropped automatically when child tables are dropped
|
|
drop table childt2, childt3;
|
|
# Drop parent table
|
|
drop table parentt1;
|