Skip to content

Commit

Permalink
rpl.rpl_invoked_features fails sporadically with "Duplicate key error"
Browse files Browse the repository at this point in the history
The reason was that Event e11 was re-executed before
"ALTER EVENT e11 DISABLE" had been executed.

Fixed by increasing re-schedule time

Other things:
- Removed double accounting of 'execution_count'. It was incremented in
  top->mark_last_executed(thd) that was executed a few lines earlier.
  • Loading branch information
montywi committed Nov 3, 2023
1 parent 7533062 commit e5a5573
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions mysql-test/suite/rpl/r/rpl_invoked_features.result
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ BEGIN
UPDATE t12 SET c = '';
UPDATE t13 SET c = '';
END|
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
CREATE EVENT e1 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
CREATE EVENT e11 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e11 DISABLE;
CALL p11(10, '');
Expand Down
9 changes: 6 additions & 3 deletions mysql-test/suite/rpl/t/rpl_invoked_features.test
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,17 @@ BEGIN
UPDATE t13 SET c = '';
END|

# Create events which will run every 1 sec
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO
# Create events which will run every 10 sec
# It cannot be much shorter as we have to ensure that a new
# event is not scheduled before the DISABLE has been
# executed.
CREATE EVENT e1 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END|

CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
CREATE EVENT e11 ON SCHEDULE EVERY 10 SECOND DISABLE DO
BEGIN
ALTER EVENT e11 DISABLE;
CALL p11(10, '');
Expand Down
1 change: 0 additions & 1 deletion sql/event_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,6 @@ Event_queue::get_top_for_execution_if_time(THD *thd,
top->status= Event_parse_data::DISABLED;
DBUG_PRINT("info", ("event %s status is %d", top->name.str, top->status));

top->execution_count++;
(*event_name)->dropped= top->dropped;
/*
Save new values of last_executed timestamp and event status on stack
Expand Down

0 comments on commit e5a5573

Please sign in to comment.