Debian Codegraph @

mysql-test/suite/rpl/t/rpl_create_drop_event.test

raw
1 --source include/master-slave.inc
2
3 connection master;
4 SET GLOBAL event_scheduler=off;
5
6 CREATE TABLE t1 (a INT);
7 CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10);
8 --error ER_EVENT_ALREADY_EXISTS
9 CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
10 CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
11 SELECT EVENT_NAME,STATUS,EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
12
13 SET GLOBAL event_scheduler=on;
14 let $wait_condition= SELECT count(*)>0 FROM t1;
15 --source include/wait_condition.inc
16 SET GLOBAL event_scheduler=off;
17 # If the time rolls to the next whole second just at this point, a new event
18 # run may be scheduled. Wait for this to disappear, otherwise we see occasional
19 # test failures if the table gets dropped before the extra event run completes.
20 # Expect 5 connections: default, master, master1, server_1, binlog dump thread
21 --let $wait_condition= SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST;
22 --source include/wait_condition.inc
23 SELECT DISTINCT a FROM t1;
24 DELETE FROM t1;
25
26 --echo # Syncing slave with master
27 sync_slave_with_master;
28 SELECT EVENT_NAME,STATUS,EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
29 connection master;
30 DROP TABLE t1;
31 DROP EVENT ev1;
32 sync_slave_with_master;
33 --source include/rpl_end.inc