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:
parent
1d2ba10a68
commit
3e1d89ff17
@ -163,13 +163,14 @@ typedef enum
|
||||
*/
|
||||
typedef struct monitor_servers
|
||||
{
|
||||
SERVER *server; /**< The server being monitored */
|
||||
MYSQL *con; /**< The MySQL connection */
|
||||
SERVER *server; /**< The server being monitored */
|
||||
MYSQL *con; /**< The MySQL connection */
|
||||
bool log_version_err;
|
||||
int mon_err_count;
|
||||
unsigned int mon_prev_status;
|
||||
unsigned int pending_status; /**< Pending Status flag bitmap */
|
||||
struct monitor_servers *next; /**< The next server in the list */
|
||||
unsigned int pending_status; /**< Pending Status flag bitmap */
|
||||
mxs_monitor_event_t last_event; /**< The last event that occurred on this server*/
|
||||
struct monitor_servers *next; /**< The next server in the list */
|
||||
} MXS_MONITOR_SERVERS;
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user