diff --git a/Documentation/Monitors/MySQL-Monitor.md b/Documentation/Monitors/MySQL-Monitor.md index e0941b561..2b825e5d8 100644 --- a/Documentation/Monitors/MySQL-Monitor.md +++ b/Documentation/Monitors/MySQL-Monitor.md @@ -78,10 +78,6 @@ With this parameter, slaves that have lost their master but have been slaves of a master server can retain their slave status even without a master. This means that when a slave loses its master, it can still be used for reads. -If MaxScale loses the connection to the slave, the slave will lose the stale -slave state because MaxScale doesn't know if the slave has had recent contact -with the master server. - If this feature is disabled, a server is considered a valid slave if and only if it has a running master server monitored by this monitor. diff --git a/Documentation/Release-Notes/MaxScale-2.0.1-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.0.1-Release-Notes.md index fe6675efc..195bacf53 100644 --- a/Documentation/Release-Notes/MaxScale-2.0.1-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.0.1-Release-Notes.md @@ -120,6 +120,7 @@ Please consult * [MXS-845](https://jira.mariadb.org/browse/MXS-845): "Server down" event is re-triggered after maintenance mode is repeated * [MXS-842](https://jira.mariadb.org/browse/MXS-842): Unexpected / undocumented behaviour when multiple available masters from mmmon monitor * [MXS-846](https://jira.mariadb.org/browse/MXS-846): MMMon: Maintenance mode on slave logs error message every second +* [MXS-860](https://jira.mariadb.org/browse/MXS-860): I want to access the web site if master server is down. ## Known Issues and Limitations diff --git a/server/core/server.c b/server/core/server.c index c4ef6426b..a29198791 100644 --- a/server/core/server.c +++ b/server/core/server.c @@ -88,6 +88,7 @@ server_alloc(char *servname, char *protocol, unsigned short port) server->persistmax = 0; server->persistmaxtime = 0; server->persistpoolmax = 0; + server->slave_configured = false; spinlock_init(&server->persistlock); spinlock_acquire(&server_spin); diff --git a/server/include/server.h b/server/include/server.h index 81a6a2313..5dfe79cfc 100644 --- a/server/include/server.h +++ b/server/include/server.h @@ -102,6 +102,8 @@ typedef struct server int depth; /**< Replication level in the tree */ long slaves[MAX_NUM_SLAVES]; /**< Slaves of this node */ bool master_err_is_logged; /*< If node failed, this indicates whether it is logged */ + bool slave_configured; /**< Server is configured as a replication slave + * TODO: Remove this for 2.1 */ DCB *persistent; /**< List of unused persistent connections to the server */ SPINLOCK persistlock; /**< Lock for adjusting the persistent connections list */ long persistpoolmax; /**< Maximum size of persistent connections pool */ diff --git a/server/modules/monitor/mysql_mon.c b/server/modules/monitor/mysql_mon.c index 6948175c1..4305505c2 100644 --- a/server/modules/monitor/mysql_mon.c +++ b/server/modules/monitor/mysql_mon.c @@ -323,8 +323,11 @@ static inline void monitor_mysql100_db(MONITOR_SERVERS* database) return; } + database->server->slave_configured = false; + while ((row = mysql_fetch_row(result))) { + database->server->slave_configured = true; /* get Slave_IO_Running and Slave_SQL_Running values*/ if (strncmp(row[12], "Yes", 3) == 0 && strncmp(row[13], "Yes", 3) == 0) @@ -407,8 +410,11 @@ static inline void monitor_mysql55_db(MONITOR_SERVERS* database) return; } + database->server->slave_configured = false; + while ((row = mysql_fetch_row(result))) { + database->server->slave_configured = true; /* get Slave_IO_Running and Slave_SQL_Running values*/ if (strncmp(row[10], "Yes", 3) == 0 && strncmp(row[11], "Yes", 3) == 0) @@ -479,8 +485,11 @@ static inline void monitor_mysql51_db(MONITOR_SERVERS* database) return; } + database->server->slave_configured = false; + while ((row = mysql_fetch_row(result))) { + database->server->slave_configured = true; /* get Slave_IO_Running and Slave_SQL_Running values*/ if (strncmp(row[10], "Yes", 3) == 0 && strncmp(row[11], "Yes", 3) == 0) @@ -994,6 +1003,11 @@ monitorMain(void *arg) { ptr->pending_status |= SERVER_SLAVE; } + else if (root_master == NULL && ptr->server->slave_configured) + { + /** TODO: Change this in 2.1 to use the server_info mechanism */ + ptr->pending_status |= SERVER_SLAVE; + } } ptr->server->status = ptr->pending_status;