Debian Codegraph @

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

raw
1 # ==== Purpose ====
2 #
3 # This test checks if an event that is drop implicitly by the scheduler is
4 # written to the binlog.
5 #
6 # ==== Implementation ====
7 #
8 # The event is first created on the master.
9 # The test sleeps for enough time so that, when the scheduler is enabled,
10 # the event is implicitly dropped because its start and end times have passed.
11 # The slave is synchronized with the master to log this drop.
12 # Finally, another event is created to check if the implicit drop was successful
13 # as it will fail on the slave synchronization, otherwise.
14 #
15 #
16 # ==== References ====
17 #
18 # BUG#22150112 REPLICATION BREAKS WITH NOT PRESERVE EVENTS
19
20 --source include/set_privilege_checks_user_as_system_user.inc
21 --source include/master-slave.inc
22
23 # Save current event scheduler status
24 SET @saved_event_scheduler= @@GLOBAL.event_scheduler;
25
26 SET GLOBAL EVENT_SCHEDULER= OFF;
27
28 CREATE EVENT e1
29 ON SCHEDULE EVERY 1 SECOND
30 STARTS NOW() ENDS NOW() + INTERVAL 2 SECOND
31 ON COMPLETION NOT PRESERVE
32 DO SELECT 1;
33
34 # sleep enough so that the event gets dropped automatically when the scheduler
35 # is enabled
36 --let $interval= 2
37 --let $naptime= `SELECT $interval + 2`
38 --sleep $naptime
39
40 SET GLOBAL EVENT_SCHEDULER= ON;
41
42 --echo Wait until the event is dropped to disable the event scheduler again.
43 --let $wait_condition= SELECT COUNT(*) = 0 FROM information_schema.events
44 --source include/wait_condition.inc
45 SET GLOBAL EVENT_SCHEDULER= OFF;
46
47 --source include/sync_slave_sql_with_master.inc
48
49 # check that we can create another event with the same name
50 --source include/rpl_connection_master.inc
51 CREATE EVENT e1
52 ON SCHEDULE EVERY 1 SECOND
53 STARTS NOW() ENDS NOW() + INTERVAL 3 SECOND
54 ON COMPLETION NOT PRESERVE
55 DO SELECT 1;
56
57 --source include/sync_slave_sql_with_master.inc
58
59 #cleanup
60 --source include/rpl_connection_master.inc
61 DROP EVENT e1;
62 # Restore the scheduler
63 SET GLOBAL EVENT_SCHEDULER= @saved_event_scheduler;
64 --source include/rpl_end.inc