Have server status updates applied during monitor loop
Previously, server status changes from MaxAdmin would be set immediately as long as the server lock could be acquired. This meant that it might take several seconds until the next monitor pass is executed. Usually, this was fine but in some situations we would want the monitor to run immediately after the change (MXS-740 and Galera). This patch changes the logic of setting and clearing status bits to a delayed mode: changes are first applied to a "status_pending"-variable, and only once the monitor runs will the setting be applied. To reduce the delay, the monitor now has a flag which is checked during sleep (between short 0.1s naps). If set, the sleep is cut short. If a server is not monitored, the status bits are set directly. There is a small possibility of a race condition: If a monitor is stopped or destroyed before the pending change is applied, the change is forgotten.
This commit is contained in:
@ -96,6 +96,7 @@ typedef struct server
|
||||
char *auth_options; /**< Authenticator options */
|
||||
SSL_LISTENER *server_ssl; /**< SSL data structure for server, if any */
|
||||
unsigned int status; /**< Status flag bitmap for the server */
|
||||
unsigned int status_pending; /**< Pending status flag bitmap for the server */
|
||||
char monuser[MAX_SERVER_MONUSER_LEN]; /**< User name to use to monitor the db */
|
||||
char monpw[MAX_SERVER_MONPW_LEN]; /**< Password to use to monitor the db */
|
||||
SERVER_STATS stats; /**< The server statistics */
|
||||
|
Reference in New Issue
Block a user