MXS-2223 Log a message when a slave is discriminated due to replication lag

Both the replication lag and the message printing state are saved in SERVER,
although the values are mostly used by readwritesplit. A log message is printed
both when a server goes over the limit and when it comes back below.
Because of concurrency issues, a message may be printed multiple times before
different threads detect the new message state.

Documentation updated to explain the change.
This commit is contained in:
Esa Korhonen
2019-01-16 14:58:08 +02:00
parent 0dfdff1f95
commit 7f978f275f
4 changed files with 72 additions and 16 deletions

View File

@ -94,6 +94,13 @@ typedef enum
SERVER_TYPE_MYSQL
} server_type_t;
typedef enum
{
RLAG_NONE,
RLAG_BELOW_LIMIT,
RLAG_ABOVE_LIMIT
} RLAG_STATE;
static inline void server_decode_version(uint64_t version, SERVER_VERSION* server_version)
{
uint32_t major = version / 10000;
@ -159,11 +166,13 @@ typedef struct server
* */
unsigned long node_ts; /**< Last timestamp set from M/S monitor module */
long master_id; /**< Master server id of this node */
// Misc fields
bool master_err_is_logged; /**< If node failed, this indicates whether it is logged. Only
* used
* by rwsplit. TODO: Move to rwsplit */
bool warn_ssl_not_enabled;/**< SSL not used for an SSL enabled server */
bool master_err_is_logged; /**< If node failed, this indicates whether it is logged. Only used
* by rwsplit. TODO: Move to rwsplit */
bool warn_ssl_not_enabled; /**< SSL not used for an SSL enabled server */
RLAG_STATE rlag_state; /**< Is replication lag above or under limit? Used by rwsplit. */
MxsDiskSpaceThreshold* disk_space_threshold;/**< Disk space thresholds */
} SERVER;