mariadb/mysql-test/suite/rpl/t/rpl_create_drop_event.test
Kristian Nielsen 7dc4ea5649 Fix sporadic test failure in rpl.rpl_create_drop_event
Depending on timing, an extra event run could start just when the event
scheduler is shut down and delay running until after the table has been
dropped; this would cause the test to fail with a "table does not exist"
error in the log.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-08-26 14:39:24 +02:00

33 lines
1.3 KiB
Text

--source include/master-slave.inc
connection master;
SET GLOBAL event_scheduler=off;
CREATE TABLE t1 (a INT);
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10);
--error ER_EVENT_ALREADY_EXISTS
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
SELECT EVENT_NAME,STATUS,EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
SET GLOBAL event_scheduler=on;
let $wait_condition= SELECT count(*)>0 FROM t1;
--source include/wait_condition.inc
SET GLOBAL event_scheduler=off;
# If the time rolls to the next whole second just at this point, a new event
# run may be scheduled. Wait for this to disappear, otherwise we see occasional
# test failures if the table gets dropped before the extra event run completes.
# Expect 5 connections: default, master, master1, server_1, binlog dump thread
--let $wait_condition= SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.PROCESSLIST;
--source include/wait_condition.inc
SELECT DISTINCT a FROM t1;
DELETE FROM t1;
--echo # Syncing slave with master
sync_slave_with_master;
SELECT EVENT_NAME,STATUS,EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
connection master;
DROP TABLE t1;
DROP EVENT ev1;
sync_slave_with_master;
--source include/rpl_end.inc