Start all tests with read_only disabled
Explicitly checking and setting read_only allows all tests to have a consistent backend state.
This commit is contained in:
@ -385,6 +385,7 @@ int Mariadb_nodes::start_replication()
|
|||||||
|
|
||||||
for (int i = 0; i < N; i++)
|
for (int i = 0; i < N; i++)
|
||||||
{
|
{
|
||||||
|
execute_query(nodes[i], "SET GLOBAL read_only=OFF");
|
||||||
execute_query(nodes[i], "STOP SLAVE;");
|
execute_query(nodes[i], "STOP SLAVE;");
|
||||||
|
|
||||||
if (g_require_gtid)
|
if (g_require_gtid)
|
||||||
@ -551,6 +552,20 @@ int Mariadb_nodes::unblock_all_nodes()
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_readonly(MYSQL* conn)
|
||||||
|
{
|
||||||
|
bool rval = false;
|
||||||
|
char output[512];
|
||||||
|
find_field(conn, "SHOW VARIABLES LIKE 'read_only'", "Value", output);
|
||||||
|
|
||||||
|
if (strcasecmp(output, "OFF") != 0)
|
||||||
|
{
|
||||||
|
rval = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
bool Mariadb_nodes::check_master_node(MYSQL *conn)
|
bool Mariadb_nodes::check_master_node(MYSQL *conn)
|
||||||
{
|
{
|
||||||
bool rval = true;
|
bool rval = true;
|
||||||
@ -600,10 +615,7 @@ bool Mariadb_nodes::check_master_node(MYSQL *conn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char output[512];
|
if (is_readonly(conn))
|
||||||
find_field(conn, "SHOW VARIABLES LIKE 'read_only'", "Value", output);
|
|
||||||
|
|
||||||
if (strcmp(output, "OFF"))
|
|
||||||
{
|
{
|
||||||
printf("The master is in read-only mode\n");
|
printf("The master is in read-only mode\n");
|
||||||
rval = false;
|
rval = false;
|
||||||
@ -754,7 +766,8 @@ int Mariadb_nodes::check_replication()
|
|||||||
else if (bad_slave_thread_status(nodes[i], "Slave_IO_Running", i) ||
|
else if (bad_slave_thread_status(nodes[i], "Slave_IO_Running", i) ||
|
||||||
bad_slave_thread_status(nodes[i], "Slave_SQL_Running", i) ||
|
bad_slave_thread_status(nodes[i], "Slave_SQL_Running", i) ||
|
||||||
wrong_replication_type(nodes[i]) ||
|
wrong_replication_type(nodes[i]) ||
|
||||||
multi_source_replication(nodes[i], i))
|
multi_source_replication(nodes[i], i) ||
|
||||||
|
is_readonly(nodes[i]))
|
||||||
{
|
{
|
||||||
res = 1;
|
res = 1;
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
|||||||
Reference in New Issue
Block a user