Bug #93777 the Originator of mysql.event is not correct
Submitted: 2 Jan 7:28 Modified: 25 Jan 15:26
Reporter: dennis gao Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.7.24, 8.0.13 OS:Any
Assigned to: Paul Dubois CPU Architecture:Any

[2 Jan 7:28] dennis gao
Description:
In https://dev.mysql.com/doc/refman/5.7/en/show-events.html, we can see the definition of Originator of mysql.event is "the server ID of the MySQL server on which the event was created.".
But the Originator of mysql.event may not present the server ID of the MySQL server on which the event was created.

For a slave mysql, if the master mysql down, we need to promote this slave to be the new master, and enable the event by using "ALTER EVENT myevent ENABLE;".
But after the execution of "ALTER EVENT myevent ENABLE;", the Originator of this event in mysql.event will be updated to the server_id of current mysql, rather than the server ID of the MySQL server on which the event was created.

How to repeat:
1. Set up a replication with two mysql: m1 and s1, the replication topo is  m1->s1, the server_id of m1 is 1 and the server_id of s1 is 2.
2. on m1 execute:
-------------------------------------------------------
SET GLOBAL event_scheduler = ON;
CREATE TABLE t2 (c1 TIME);
CREATE DEFINER=`root`@`localhost` EVENT `myevent` ON SCHEDULE EVERY 1 SECOND ON COMPLETION PRESERVE DO INSERT INTO t2 VALUES(now());
-------------------------------------------------------

By execution "select * from mysql.events;" on m1 and s1, we can see the Originator  is 1.

3. shutdown m1, and execute the following sql on s1:
-----------------------------------------------------------------
STOP SLAVE;
SET GLOBAL event_scheduler = ON;
ALTER EVENT test.myevent ENABLE;
-------------------------------------------------------

By execution "select * from mysql.events;" on s1, we can see the Originator  is 2.
 

Suggested fix:
none.
[2 Jan 9:40] Umesh Shastry
Hello Dennis Gao,

Thank you for the report and test case.

Thanks,
Umesh
[25 Jan 15:26] Paul Dubois
Posted by developer:
 
Modified the description of Originator column (and INFORMATION_SCHEMA.EVENTS.ORIGINATOR column) to:

The server ID of the MySQL server on which the event was created;
used in replication. This value may be updated by ALTER EVENT to the
server ID of the server on which that statement occurs, if executed
on a master server. The default value is 0.