MXS-2652 Do not clear maintenance flag when a server goes down

The set of flags to clear should be well-defined.
This commit is contained in:
Esa Korhonen
2019-08-30 18:14:04 +03:00
parent ea9a823a25
commit 00feb61b23
3 changed files with 8 additions and 10 deletions

View File

@ -118,6 +118,10 @@ public:
static int64_t get_time_ms();
protected:
// When a monitor detects that a server is down, these bits should be cleared.
static constexpr uint64_t SERVER_DOWN_CLEAR_BITS {SERVER_RUNNING | SERVER_AUTH_ERROR | SERVER_MASTER
| SERVER_SLAVE | SERVER_SLAVE_OF_EXT_MASTER | SERVER_RELAY | SERVER_JOINED | SERVER_NDB};
MonitorInstance(MXS_MONITOR* pMonitor);
/**

View File

@ -2839,18 +2839,12 @@ void MonitorInstanceSimple::tick()
* the server state bits. This would allow clearing the state by
* zeroing it out.
*/
const uint64_t bits_to_clear = ~SERVER_WAS_MASTER;
monitor_clear_pending_status(pMs, bits_to_clear);
monitor_clear_pending_status(pMs, SERVER_DOWN_CLEAR_BITS);
if (mysql_errno(pMs->con) == ER_ACCESS_DENIED_ERROR)
{
monitor_set_pending_status(pMs, SERVER_AUTH_ERROR);
}
else
{
monitor_clear_pending_status(pMs, SERVER_AUTH_ERROR);
}
if (mon_status_changed(pMs) && mon_print_fail_status(pMs))
{

View File

@ -379,9 +379,9 @@ void MariaDBMonitor::update_server(MariaDBServer* server)
}
else
{
/* The current server is not running. Clear all but the stale master bit as it is used to detect
* masters that went down but came up. */
server->clear_status(~SERVER_WAS_MASTER);
// The server is not running. Clear some of the bits. User-set bits and some long-term bits
// can stay.
server->clear_status(SERVER_DOWN_CLEAR_BITS);
auto conn_errno = mysql_errno(conn);
if (conn_errno == ER_ACCESS_DENIED_ERROR || conn_errno == ER_ACCESS_DENIED_NO_PASSWORD_ERROR)
{