MXS-359: Test read-only mode and master replacement

Added test cases that verify that the functionality works as
expected. Also made Mariadb_nodes::change_master less verbose when one of
the nodes is down.
This commit is contained in:
Markus Mäkelä
2018-03-12 09:39:16 +02:00
parent 57b18cc0ce
commit 62d4fa822d
4 changed files with 211 additions and 3 deletions

View File

@ -259,13 +259,19 @@ int Mariadb_nodes::change_master(int NewMaster, int OldMaster)
{
for (int i = 0; i < N; i++)
{
execute_query(nodes[i], "STOP SLAVE");
if (mysql_ping(nodes[i]) == 0)
{
execute_query(nodes[i], "STOP SLAVE");
}
}
execute_query(nodes[NewMaster], "RESET SLAVE ALL");
execute_query(nodes[NewMaster], create_repl_user);
execute_query(nodes[OldMaster], "RESET MASTER");
if (mysql_ping(nodes[OldMaster]) == 0)
{
execute_query(nodes[OldMaster], "RESET MASTER");
}
char log_file[256];
char log_pos[256];
find_field(nodes[NewMaster], "show master status", "File", &log_file[0]);
@ -273,7 +279,7 @@ int Mariadb_nodes::change_master(int NewMaster, int OldMaster)
for (int i = 0; i < N; i++)
{
if (i != NewMaster)
if (i != NewMaster && mysql_ping(nodes[i]) == 0)
{
char str[1024];
sprintf(str, setup_slave, IP[NewMaster], log_file, log_pos, port[NewMaster]);