MXS-1937 Add failover/switchover with server events test

The test adds a scheduled server event, the does failover, rejoin and
switchover and checks that event is manipulated correctly. Also includes
a change to the monitor to fix an invalid ALTER EVENT query when the event
definer has wildcard host.
This commit is contained in:
Esa Korhonen
2018-09-19 19:49:01 +03:00
parent e5a0b4e9bb
commit dfc10b109d
5 changed files with 291 additions and 1 deletions

View File

@ -1754,6 +1754,23 @@ void TestConnections::tprintf(const char* format, ...)
fflush(stderr);
}
int TestConnections::get_master_server_id(int m)
{
int master_id = -1;
MYSQL* conn = maxscales->open_rwsplit_connection(m);
char str[100];
if (find_field(conn, "SELECT @@server_id, @@last_insert_id;", "@@server_id", str) == 0)
{
char* endptr = NULL;
auto colvalue = strtol(str, &endptr, 0);
if (endptr && *endptr == '\0')
{
master_id = colvalue;
}
}
mysql_close(conn);
return master_id;
}
void* timeout_thread(void* ptr)
{
TestConnections* Test = (TestConnections*) ptr;