Merge branch '2.2' into develop
This commit is contained in:
@ -313,30 +313,31 @@ uint32_t MariaDBMonitor::do_rejoin(const ServerArray& joinable_servers, json_t**
|
||||
{
|
||||
MariaDBServer* joinable = *iter;
|
||||
const char* name = joinable->name();
|
||||
if (!m_demote_sql_file.empty() && !joinable->run_sql_from_file(m_demote_sql_file, output))
|
||||
|
||||
bool op_success = false;
|
||||
if (joinable->n_slaves_configured == 0)
|
||||
{
|
||||
PRINT_MXS_JSON_ERROR(output, "%s execution failed when attempting to rejoin server '%s'.",
|
||||
CN_DEMOTION_SQL_FILE, joinable->name());
|
||||
}
|
||||
else
|
||||
{
|
||||
bool op_success;
|
||||
if (joinable->n_slaves_configured == 0)
|
||||
if (!m_demote_sql_file.empty() && !joinable->run_sql_from_file(m_demote_sql_file, output))
|
||||
{
|
||||
PRINT_MXS_JSON_ERROR(output, "%s execution failed when attempting to rejoin server '%s'.",
|
||||
CN_DEMOTION_SQL_FILE, joinable->name());
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_NOTICE("Directing standalone server '%s' to replicate from '%s'.", name, master_name);
|
||||
op_success = joinable->join_cluster(change_cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_NOTICE("Server '%s' is replicating from a server other than '%s', "
|
||||
"redirecting it to '%s'.", name, master_name, master_name);
|
||||
op_success = joinable->redirect_one_slave(change_cmd);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_NOTICE("Server '%s' is replicating from a server other than '%s', "
|
||||
"redirecting it to '%s'.", name, master_name, master_name);
|
||||
op_success = joinable->redirect_one_slave(change_cmd);
|
||||
}
|
||||
|
||||
if (op_success)
|
||||
{
|
||||
servers_joined++;
|
||||
}
|
||||
if (op_success)
|
||||
{
|
||||
servers_joined++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -645,7 +645,7 @@ bool MariaDBServer::run_sql_from_file(const string& path, json_t** error_out)
|
||||
std::ifstream sql_file(path);
|
||||
if (sql_file.is_open())
|
||||
{
|
||||
MXS_NOTICE("Executing sql queries from file '%s'.", path.c_str());
|
||||
MXS_NOTICE("Executing sql queries from file '%s' on server '%s'.", path.c_str(), name());
|
||||
int lines_executed = 0;
|
||||
|
||||
while (!sql_file.eof() && !error)
|
||||
@ -664,6 +664,12 @@ bool MariaDBServer::run_sql_from_file(const string& path, json_t** error_out)
|
||||
if (mxs_mysql_query(conn, line.c_str()) == 0)
|
||||
{
|
||||
lines_executed++;
|
||||
// Discard results if any.
|
||||
MYSQL_RES* res = mysql_store_result(conn);
|
||||
if (res != NULL)
|
||||
{
|
||||
mysql_free_result(res);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -266,7 +266,8 @@ public:
|
||||
bool failover_wait_relay_log(int seconds_remaining, json_t** err_out);
|
||||
|
||||
/**
|
||||
* Read the file contents and send them as sql queries to the server. Queries should not return any data.
|
||||
* Read the file contents and send them as sql queries to the server. Any data returned by the queries is
|
||||
* discarded.
|
||||
*
|
||||
* @param server Server to send queries to
|
||||
* @param path Text file path.
|
||||
|
||||
@ -88,7 +88,7 @@ int main(int argc, char **argv)
|
||||
char *key_file = NULL;
|
||||
char *aes_algo = NULL;
|
||||
int report_header = 0;
|
||||
char c;
|
||||
int c;
|
||||
BINLOG_FILE_FIX binlog_file = {0, false, false};
|
||||
|
||||
#ifdef HAVE_GLIBC
|
||||
|
||||
Reference in New Issue
Block a user