Separate unknown server version from old versions

This allows better failover support detection.
This commit is contained in:
Esa Korhonen
2018-08-10 18:31:50 +03:00
parent ddc422b102
commit 681c456bd7
4 changed files with 10 additions and 3 deletions

View File

@ -1355,7 +1355,10 @@ bool MariaDBMonitor::cluster_supports_failover(string* reasons_out)
// Gtid-replication is required, and a server version which supports it. // Gtid-replication is required, and a server version which supports it.
for (MariaDBServer* server : m_servers) for (MariaDBServer* server : m_servers)
{ {
if (server->m_version != MariaDBServer::version::MARIADB_100) // Need to accept unknown versions here. Otherwise servers which are down when the monitor starts
// would deactivate failover.
if (server->m_version != MariaDBServer::version::UNKNOWN &&
server->m_version != MariaDBServer::version::MARIADB_100)
{ {
*reasons_out += separator + string_printf("The version of server '%s' is not supported. Failover " *reasons_out += separator + string_printf("The version of server '%s' is not supported. Failover "
"requires MariaDB 10.X.", server->name()); "requires MariaDB 10.X.", server->name());

View File

@ -356,7 +356,9 @@ void MariaDBMonitor::update_server(MariaDBServer& server)
server.update_server_version(); server.update_server_version();
} }
if (server.m_version != MariaDBServer::version::UNKNOWN) if (server.m_version == MariaDBServer::version::MARIADB_MYSQL_55 ||
server.m_version == MariaDBServer::version::MARIADB_100 ||
server.m_version == MariaDBServer::version::BINLOG_ROUTER)
{ {
// Check permissions if permissions failed last time or if this is a new connection. // Check permissions if permissions failed last time or if this is a new connection.
if (server.had_status(SERVER_AUTH_ERROR) || conn_status == MONITOR_CONN_NEWCONN_OK) if (server.had_status(SERVER_AUTH_ERROR) || conn_status == MONITOR_CONN_NEWCONN_OK)

View File

@ -874,6 +874,7 @@ void MariaDBServer::update_server_version()
} }
else else
{ {
m_version = version::OLD;
MXS_ERROR("MariaDB/MySQL version of server '%s' is less than 5.5, which is not supported. " MXS_ERROR("MariaDB/MySQL version of server '%s' is less than 5.5, which is not supported. "
"The server is ignored by the monitor. Server version: '%s'.", name(), "The server is ignored by the monitor. Server version: '%s'.", name(),
srv->version_string); srv->version_string);

View File

@ -123,7 +123,8 @@ public:
typedef std::vector<SlaveStatus> SlaveStatusArray; typedef std::vector<SlaveStatus> SlaveStatusArray;
enum class version enum class version
{ {
UNKNOWN, /* Anything older than 5.5. These are no longer supported by the monitor. */ UNKNOWN, /* Totally unknown. Server has not been connected to yet. */
OLD, /* Anything older than 5.5. These are no longer supported by the monitor. */
MARIADB_MYSQL_55, /* MariaDB 5.5 series or MySQL 5.5 and later. Does not have gtid (on MariaDB) so MARIADB_MYSQL_55, /* MariaDB 5.5 series or MySQL 5.5 and later. Does not have gtid (on MariaDB) so
* all gtid-related features (failover etc.) are disabled. */ * all gtid-related features (failover etc.) are disabled. */
MARIADB_100, /* MariaDB 10.0 and greater. In practice though, 10.0.2 or greater is assumed. MARIADB_100, /* MariaDB 10.0 and greater. In practice though, 10.0.2 or greater is assumed.