MXS-1446: Store last triggered event for each server
When an event occurs on a server, it is now stored so that the last event for each server is known. This allows a state change to trigger an event even if, at the time of the event, no action was taken. This change is only cosmetic as no functionality is implemented.
This commit is contained in:
@ -321,6 +321,7 @@ bool monitorAddServer(MXS_MONITOR *mon, SERVER *server)
|
||||
db->next = NULL;
|
||||
db->mon_err_count = 0;
|
||||
db->log_version_err = true;
|
||||
db->last_event = UNDEFINED_EVENT;
|
||||
/** Server status is uninitialized */
|
||||
db->mon_prev_status = -1;
|
||||
/* pending status is updated by get_replication_tree */
|
||||
@ -1709,6 +1710,16 @@ void mon_process_state_changes(MXS_MONITOR *monitor, const char *script, uint64_
|
||||
{
|
||||
mon_log_state_change(ptr);
|
||||
|
||||
/**
|
||||
* The last executed event will be needed if a passive MaxScale is
|
||||
* promoted to an active one and the last event that occurred on
|
||||
* a server was a master_down event.
|
||||
*
|
||||
* In this case, a failover script should be called if no master_up
|
||||
* or new_master events are triggered within a pre-defined time limit.
|
||||
*/
|
||||
ptr->last_event = mon_get_event_type(ptr);
|
||||
|
||||
if (script && (events & mon_get_event_type(ptr)))
|
||||
{
|
||||
monitor_launch_script(monitor, ptr, script);
|
||||
|
||||
Reference in New Issue
Block a user