Add test case for ignore_external_masters + failover

The test checks that failover works even when the master of the monitored
cluster is a slave to an external masters. The test also verifies that the
servers do not get unexpected status labels.
This commit is contained in:
Markus Mäkelä
2018-02-07 00:41:49 +02:00
parent 8bf756ca56
commit 6a1aba70e7
9 changed files with 241 additions and 34 deletions

View File

@ -15,6 +15,7 @@
#include <climits>
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
namespace
@ -1457,3 +1458,21 @@ int Mariadb_nodes::prepare_servers()
}
return rval;
}
void Mariadb_nodes::replicate_from(int slave, int master, const char* type)
{
std::stringstream change_master;
change_master << "CHANGE MASTER TO MASTER_HOST = '" << IP[master]
<< "', MASTER_PORT = " << port[master] << ", MASTER_USE_GTID = " << type << ", "
"MASTER_USER='repl', MASTER_PASSWORD='repl';";
if (verbose)
{
std::cout << "Server " << slave + 1 << " starting to replicate from server " << master + 1 << std::endl;
std::cout << "Query is '" << change_master.str() << "'" << std::endl;
}
execute_query(nodes[slave], "STOP SLAVE;");
execute_query(nodes[slave], change_master.str().c_str());
execute_query(nodes[slave], "START SLAVE;");
}