Only write to SERVER->status at the end of a monitoring loop
This makes the code clearer and reduces race conditions, as the monitor could be writing SERVER->status while a router is reading it. Also, the time during which the SERVER struct is locked drops to a fraction.
This commit is contained in:
@ -205,6 +205,16 @@ public:
|
||||
*/
|
||||
bool is_down() const;
|
||||
|
||||
/**
|
||||
* Convenience method for SERVER_IN_MAINT
|
||||
*/
|
||||
bool is_in_maintenance() const;
|
||||
|
||||
/**
|
||||
* Convenience method for SERVER_IS_RELAY_SERVER
|
||||
*/
|
||||
bool is_relay_server() const;
|
||||
|
||||
/**
|
||||
* Returns the server name.
|
||||
*
|
||||
@ -299,6 +309,20 @@ public:
|
||||
*/
|
||||
void update_server(MXS_MONITOR* base_monitor);
|
||||
|
||||
/**
|
||||
* Clear server pending status flags.
|
||||
*
|
||||
* @param bits Which flags to clear
|
||||
*/
|
||||
void clear_status(uint64_t bits);
|
||||
|
||||
/**
|
||||
* Set server pending status flags.
|
||||
*
|
||||
* @param bits Which flags to set
|
||||
*/
|
||||
void set_status(uint64_t bits);
|
||||
|
||||
private:
|
||||
void monitor_server(MXS_MONITOR* base_monitor);
|
||||
bool update_slave_status(std::string* errmsg_out = NULL);
|
||||
|
||||
Reference in New Issue
Block a user