mirror of
https://github.com/MariaDB/server.git
synced 2025-12-28 08:10:14 +00:00
MDEV-21758 : Events switched randomly to SLAVESIDE_DISABLED
Change events only on Galera environment where idea is that event is enabled only on one node of the cluster and nodes are identified by server_id.
This commit is contained in:
parent
d7f74150e5
commit
2bf4e574ad
@ -110,3 +110,30 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
|
||||
test e1 root@localhost SYSTEM RECURRING # 1 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP EVENT e1;
|
||||
# end test for bug#11748899
|
||||
#
|
||||
# Test for MDEV-21758 Events switched randomly to SLAVESIDE_DISABLED
|
||||
#
|
||||
create event ev on schedule every 1 minute do set @a= 1;
|
||||
select name, originator, status from mysql.event;
|
||||
name originator status
|
||||
ev 1 ENABLED
|
||||
#
|
||||
# Restarting server with server_id=100
|
||||
#
|
||||
select @@global.server_id;
|
||||
@@global.server_id
|
||||
100
|
||||
select name, originator, status from mysql.event;
|
||||
name originator status
|
||||
ev 1 ENABLED
|
||||
set global server_id= 1;
|
||||
#
|
||||
# Restarting server with the original server_id=1
|
||||
#
|
||||
select @@global.server_id;
|
||||
@@global.server_id
|
||||
1
|
||||
select name, originator, status from mysql.event;
|
||||
name originator status
|
||||
ev 1 ENABLED
|
||||
drop event ev;
|
||||
|
||||
@ -141,3 +141,34 @@ SHOW EVENTS;
|
||||
DROP EVENT e1;
|
||||
|
||||
--echo # end test for bug#11748899
|
||||
|
||||
--echo #
|
||||
--echo # Test for MDEV-21758 Events switched randomly to SLAVESIDE_DISABLED
|
||||
--echo #
|
||||
|
||||
create event ev on schedule every 1 minute do set @a= 1;
|
||||
select name, originator, status from mysql.event;
|
||||
|
||||
--let $server_id= `SELECT @@global.server_id`
|
||||
|
||||
--echo #
|
||||
--echo # Restarting server with server_id=100
|
||||
--echo #
|
||||
--let $restart_parameters= --server-id=100
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
select @@global.server_id;
|
||||
select name, originator, status from mysql.event;
|
||||
--eval set global server_id= $server_id
|
||||
|
||||
--echo #
|
||||
--echo # Restarting server with the original server_id=$server_id
|
||||
--echo #
|
||||
--let $restart_parameters=
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
select @@global.server_id;
|
||||
select name, originator, status from mysql.event;
|
||||
|
||||
# Cleanup
|
||||
drop event ev;
|
||||
|
||||
@ -1201,9 +1201,9 @@ Events::load_events_from_db(THD *thd)
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
/**
|
||||
IF SST is done from a galera node that is also acting as MASTER
|
||||
newly synced node in galera eco-system will also copy-over the event state
|
||||
enabling duplicate event in galera eco-system.
|
||||
If SST is done from a galera node that is also acting as MASTER
|
||||
newly synced node in galera eco-system will also copy-over the
|
||||
event state enabling duplicate event in galera eco-system.
|
||||
DISABLE such events if the current node is not event orginator.
|
||||
(Also, make sure you skip disabling it if is already disabled to avoid
|
||||
creation of redundant action)
|
||||
@ -1213,7 +1213,7 @@ Events::load_events_from_db(THD *thd)
|
||||
Infact, based on galera use-case it seems like it recommends to have each
|
||||
node with different server-id.
|
||||
*/
|
||||
if (et->originator != thd->variables.server_id)
|
||||
if (WSREP(thd) && et->originator != thd->variables.server_id)
|
||||
{
|
||||
if (et->status == Event_parse_data::SLAVESIDE_DISABLED)
|
||||
continue;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user