mariadb/mysql-test/suite/perfschema/t/trigger_table_io.test
Sergei Golubchik d74414399d perfschema 5.6.10 initial commit.
10.0 files
2014-05-06 23:20:50 +02:00

74 lines
1.9 KiB
Text

# Tests for PERFORMANCE_SCHEMA table io
--source include/not_embedded.inc
--source include/have_perfschema.inc
--source ../include/table_io_setup_helper.inc
let $engine_type= MyISAM;
--disable_warnings
drop table if exists test.t1;
drop table if exists test.t2;
--enable_warnings
eval create table test.t1 (a int, v int) engine = $engine_type;
eval create table test.t2 (b int, v int) engine = $engine_type;
create trigger t1_bi before insert on t1
for each row insert into test.t2 set b = new.a, v = 0;
create trigger t1_ai after insert on t1
for each row update test.t2 set v = 1 where b = new.a;
create trigger t1_bu before update on t1
for each row update test.t2 set v = 3 where b = old.a;
create trigger t1_au after update on t1
for each row update test.t2 set v = 4 where b = new.a;
create trigger t1_bd before delete on t1
for each row delete from test.t2 where b = old.a;
create trigger t1_ad after delete on t1
for each row insert into test.t2 set b = old.a, v = 99;
# Start recording events
update performance_schema.setup_consumers set enabled = 'YES';
# Code to test
insert into marker set a = 1;
insert into t1 set a = 1, v = 10;
insert into marker set a = 1;
insert into t1 set a = 2, v = 20;
insert into marker set a = 1;
select * from t1;
insert into marker set a = 1;
select * from t2;
insert into marker set a = 1;
update t1 set v = v + 100;
insert into marker set a = 1;
select * from t1;
insert into marker set a = 1;
select * from t2;
insert into marker set a = 1;
delete from t1 where a = 1;
insert into marker set a = 1;
select * from t1;
insert into marker set a = 1;
select * from t2;
insert into marker set a = 1;
delete from t1 where a = 2;
insert into marker set a = 1;
select * from t1;
insert into marker set a = 1;
select * from t2;
# Stop recording events + pull results
--source ../include/table_io_result_helper.inc
# Cleanup
drop table test.t1;
drop table test.t2;
--source ../include/table_io_cleanup_helper.inc