Merge branch '2.2' into develop
This commit is contained in:
@ -36,7 +36,7 @@ These tutorials are for specific use cases and module combinations.
|
||||
|
||||
- [Administration Tutorial](Tutorials/Administration-Tutorial.md)
|
||||
- [Avro Router Tutorial](Tutorials/Avrorouter-Tutorial.md)
|
||||
- [MaxScale Failover with Keepalived and MaxCtrl](Tutorials/MaxScale-Failover-with-Keepalived-and-MaxCtrl.md)
|
||||
- [Failover with Keepalived and MaxCtrl](Tutorials/MaxScale-Failover-with-Keepalived-and-MaxCtrl.md)
|
||||
- [Filter Tutorial](Tutorials/Filter-Tutorial.md)
|
||||
- [Galera Cluster Connection Routing Tutorial](Tutorials/Galera-Cluster-Connection-Routing-Tutorial.md)
|
||||
- [Galera Gluster Read Write Splitting Tutorial](Tutorials/Galera-Cluster-Read-Write-Splitting-Tutorial.md)
|
||||
|
||||
@ -20,9 +20,10 @@ void* query_thr(void* data)
|
||||
|
||||
while (running)
|
||||
{
|
||||
if (mysql_query(mysql, "SET sql_log_bin = 0") ||
|
||||
if (mysql_query(mysql, "SET max_statement_time = 30") ||
|
||||
mysql_query(mysql, "SET sql_log_bin = 0") ||
|
||||
mysql_query(mysql, "INSERT INTO test.mxs1585 VALUES (1)") ||
|
||||
mysql_query(mysql, "DELETE FROM test.mxs1585"))
|
||||
mysql_query(mysql, "DELETE FROM test.mxs1585 LIMIT 100"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ int main(int argc, char** argv)
|
||||
StringSet master = {"Master", "Running"};
|
||||
StringSet slave = {"Slave", "Running"};
|
||||
StringSet relay_master = {"Relay Master", "Slave", "Running"};
|
||||
StringSet relay_master_only = {"Relay Master", "Running"};
|
||||
|
||||
test.tprintf("Checking before stopping IO thread");
|
||||
int exit_code;
|
||||
@ -41,7 +42,7 @@ int main(int argc, char** argv)
|
||||
free(output);
|
||||
test.add_result(test.maxscales->get_server_status("server1") != master, "server1 is not a master");
|
||||
test.add_result(test.maxscales->get_server_status( "server2") != slave, "server2 is not a slave");
|
||||
test.add_result(test.maxscales->get_server_status("server3") != relay_master, "server3 is not a relay master");
|
||||
test.add_result(test.maxscales->get_server_status("server3") != relay_master_only, "server3 is not a relay master");
|
||||
test.add_result(test.maxscales->get_server_status("server4") != slave, "server4 is not a slave");
|
||||
|
||||
test.repl->fix_replication();
|
||||
|
||||
@ -2485,7 +2485,11 @@ void service_print_users(DCB *dcb, const SERVICE *service)
|
||||
if (listener_is_active(listener) && listener->listener &&
|
||||
listener->listener->authfunc.diagnostic)
|
||||
{
|
||||
dcb_printf(dcb, "User names (%s): ", listener->name);
|
||||
|
||||
listener->listener->authfunc.diagnostic(dcb, listener);
|
||||
|
||||
dcb_printf(dcb, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,7 +166,6 @@ public:
|
||||
dcb_printf(dcb, "%s%s", sep, it->first.c_str());
|
||||
sep = ", ";
|
||||
}
|
||||
dcb_printf(dcb, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,17 +323,7 @@ void users_default_diagnostic(DCB* dcb, SERV_LISTENER* port)
|
||||
{
|
||||
if (port->users)
|
||||
{
|
||||
Users* u = reinterpret_cast<Users*>(port->users);
|
||||
|
||||
if (u->empty())
|
||||
{
|
||||
dcb_printf(dcb, "Users table is empty\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
dcb_printf(dcb, "User names: ");
|
||||
users_diagnostic(dcb, port->users);
|
||||
}
|
||||
users_diagnostic(dcb, port->users);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -641,8 +641,6 @@ int diag_cb(void *data, int columns, char **row, char **field_names)
|
||||
|
||||
void mysql_auth_diagnostic(DCB *dcb, SERV_LISTENER *port)
|
||||
{
|
||||
dcb_printf(dcb, "User names: ");
|
||||
|
||||
MYSQL_AUTH *instance = (MYSQL_AUTH*)port->auth_instance;
|
||||
sqlite3* handle = get_handle(instance);
|
||||
char *err;
|
||||
@ -650,11 +648,10 @@ void mysql_auth_diagnostic(DCB *dcb, SERV_LISTENER *port)
|
||||
if (sqlite3_exec(handle, "SELECT user, host FROM " MYSQLAUTH_USERS_TABLE_NAME,
|
||||
diag_cb, dcb, &err) != SQLITE_OK)
|
||||
{
|
||||
dcb_printf(dcb, "Failed to print users: %s\n", err);
|
||||
MXS_ERROR("Failed to print users: %s", err);
|
||||
dcb_printf(dcb, "Could not access users: %s", err);
|
||||
MXS_ERROR("Could not access users: %s", err);
|
||||
sqlite3_free(err);
|
||||
}
|
||||
dcb_printf(dcb, "\n");
|
||||
}
|
||||
|
||||
int diag_cb_json(void *data, int columns, char **row, char **field_names)
|
||||
|
||||
@ -212,7 +212,7 @@ bool MariaDBMonitor::get_joinable_servers(ServerVector* output)
|
||||
server != NULL;
|
||||
server = server->next)
|
||||
{
|
||||
if (server_is_rejoin_suspect(server, master_info))
|
||||
if (server_is_rejoin_suspect(server, master_info, NULL))
|
||||
{
|
||||
suspects.push_back(server);
|
||||
}
|
||||
@ -267,12 +267,13 @@ bool MariaDBMonitor::join_cluster(MXS_MONITORED_SERVER* server, const char* chan
|
||||
return rval;
|
||||
}
|
||||
|
||||
bool MariaDBMonitor::server_is_rejoin_suspect(MXS_MONITORED_SERVER* server, MySqlServerInfo* master_info)
|
||||
bool MariaDBMonitor::server_is_rejoin_suspect(MXS_MONITORED_SERVER* rejoin_server,
|
||||
MySqlServerInfo* master_info, json_t** output)
|
||||
{
|
||||
bool is_suspect = false;
|
||||
if (!SERVER_IS_MASTER(server->server) && SERVER_IS_RUNNING(server->server))
|
||||
if (!SERVER_IS_MASTER(rejoin_server->server) && SERVER_IS_RUNNING(rejoin_server->server))
|
||||
{
|
||||
MySqlServerInfo* server_info = get_server_info(this, server);
|
||||
MySqlServerInfo* server_info = get_server_info(this, rejoin_server);
|
||||
SlaveStatusInfo* slave_status = &server_info->slave_status;
|
||||
// Has no slave connection, yet is not a master.
|
||||
if (server_info->n_slaves_configured == 0)
|
||||
@ -297,6 +298,11 @@ bool MariaDBMonitor::server_is_rejoin_suspect(MXS_MONITORED_SERVER* server, MySq
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (output != NULL)
|
||||
{
|
||||
PRINT_MXS_JSON_ERROR(output, "Server '%s' is master or not running.",
|
||||
rejoin_server->server->unique_name);
|
||||
}
|
||||
return is_suspect;
|
||||
}
|
||||
|
||||
|
||||
@ -518,39 +518,50 @@ bool mysql_rejoin(MXS_MONITOR* mon, SERVER* rejoin_server, json_t** output)
|
||||
MariaDBMonitor *handle = static_cast<MariaDBMonitor*>(mon->handle);
|
||||
if (handle->cluster_can_be_joined())
|
||||
{
|
||||
const char* rejoin_serv_name = rejoin_server->unique_name;
|
||||
MXS_MONITORED_SERVER* mon_server = mon_get_monitored_server(mon, rejoin_server);
|
||||
if (mon_server)
|
||||
{
|
||||
MXS_MONITORED_SERVER* master = handle->master;
|
||||
const char* master_name = master->server->unique_name;
|
||||
MySqlServerInfo* master_info = get_server_info(handle, master);
|
||||
MySqlServerInfo* server_info = get_server_info(handle, mon_server);
|
||||
|
||||
if (handle->server_is_rejoin_suspect(mon_server, master_info) &&
|
||||
handle->update_gtids(master, master_info) &&
|
||||
can_replicate_from(handle, mon_server, server_info, master, master_info))
|
||||
if (handle->server_is_rejoin_suspect(mon_server, master_info, output))
|
||||
{
|
||||
ServerVector joinable_server;
|
||||
joinable_server.push_back(mon_server);
|
||||
if (handle->do_rejoin(joinable_server) == 1)
|
||||
if (handle->update_gtids(master, master_info))
|
||||
{
|
||||
rval = true;
|
||||
MXS_NOTICE("Rejoin performed.");
|
||||
if (can_replicate_from(handle, mon_server, server_info, master, master_info))
|
||||
{
|
||||
ServerVector joinable_server;
|
||||
joinable_server.push_back(mon_server);
|
||||
if (handle->do_rejoin(joinable_server) == 1)
|
||||
{
|
||||
rval = true;
|
||||
MXS_NOTICE("Rejoin performed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT_MXS_JSON_ERROR(output, "Rejoin attempted but failed.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT_MXS_JSON_ERROR(output, "Server '%s' cannot replicate from cluster master '%s' "
|
||||
"or it could not be queried.", rejoin_serv_name, master_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT_MXS_JSON_ERROR(output, "Rejoin attempted but failed.");
|
||||
PRINT_MXS_JSON_ERROR(output, "Cluster master '%s' gtid info could not be updated.",
|
||||
master_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT_MXS_JSON_ERROR(output, "Server is not eligible for rejoin or eligibility could not be "
|
||||
"ascertained.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT_MXS_JSON_ERROR(output, "The given server '%s' is not monitored by this monitor.",
|
||||
rejoin_server->unique_name);
|
||||
rejoin_serv_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1168,7 +1179,12 @@ bool MariaDBMonitor::do_show_slave_status(MySqlServerInfo* serv_info, MXS_MONITO
|
||||
* root master server.
|
||||
* Please note, there could be no slaves at all if Slave_SQL_Running == 'No'
|
||||
*/
|
||||
if (serv_info->slave_status.slave_io_running && server_version != MYSQL_SERVER_VERSION_51)
|
||||
const char* last_io_errno = mxs_mysql_get_value(result, row, "Last_IO_Errno");
|
||||
int io_errno = last_io_errno ? atoi(last_io_errno) : 0;
|
||||
const int connection_errno = 2003;
|
||||
|
||||
if ((io_errno == 0 || io_errno == connection_errno) &&
|
||||
server_version != MYSQL_SERVER_VERSION_51)
|
||||
{
|
||||
/* Get Master_Server_Id */
|
||||
master_server_id = scan_server_id(row[i_master_server_id]);
|
||||
|
||||
@ -133,11 +133,13 @@ public:
|
||||
* Checks if a server is a possible rejoin candidate. A true result from this function is not yet sufficient
|
||||
* criteria and another call to can_replicate_from() should be made.
|
||||
*
|
||||
* @param server Server to check.
|
||||
* @param server Server to check
|
||||
* @param master_info Master server info
|
||||
* @param output Error output. If NULL, no error is printed to log.
|
||||
* @return True, if server is a rejoin suspect.
|
||||
*/
|
||||
bool server_is_rejoin_suspect(MXS_MONITORED_SERVER* server, MySqlServerInfo* master_info);
|
||||
bool server_is_rejoin_suspect(MXS_MONITORED_SERVER* server, MySqlServerInfo* master_info,
|
||||
json_t** output);
|
||||
|
||||
/**
|
||||
* (Re)join given servers to the cluster. The servers in the array are assumed to be joinable.
|
||||
|
||||
Reference in New Issue
Block a user