Fix master server version checks in tests

The master server version was not processed adequately and false positives
of old master versions were possible.
This commit is contained in:
Markus Mäkelä
2017-07-03 16:53:25 +03:00
parent f7bd195e9f
commit 5a26d17fcf

View File

@ -796,36 +796,35 @@ int TestConnections::copy_all_logs_periodic()
int TestConnections::prepare_binlog() int TestConnections::prepare_binlog()
{ {
char version_str[1024]; char version_str[1024] = "";
find_field(repl->nodes[0], "SELECT @@VERSION", "@@version", version_str);
tprintf("Master server version %s\n", version_str);
if ((strstr(version_str, "10.0") != NULL) || repl->connect();
(strstr(version_str, "10.1") != NULL) || find_field(repl->nodes[0], "SELECT @@version", "@@version", version_str);
(strstr(version_str, "10.2") != NULL)) tprintf("Master server version '%s'", version_str);
{
tprintf("10.0!\n"); if (*version_str &&
} strstr(version_str, "10.0") == NULL &&
else strstr(version_str, "10.1") == NULL &&
strstr(version_str, "10.2") == NULL)
{ {
add_result(ssh_maxscale(true, add_result(ssh_maxscale(true,
"sed -i \"s/,mariadb10-compatibility=1//\" %s", "sed -i \"s/,mariadb10-compatibility=1//\" %s",
maxscale_cnf), "Error editing maxscale.cnf"); maxscale_cnf), "Error editing maxscale.cnf");
} }
tprintf("Removing all binlog data from Maxscale node\n"); tprintf("Removing all binlog data from Maxscale node");
add_result(ssh_maxscale(true, "rm -rf %s", maxscale_binlog_dir), add_result(ssh_maxscale(true, "rm -rf %s", maxscale_binlog_dir),
"Removing binlog data failed\n"); "Removing binlog data failed");
tprintf("Creating binlog dir\n"); tprintf("Creating binlog dir");
add_result(ssh_maxscale(true, "mkdir -p %s", maxscale_binlog_dir), add_result(ssh_maxscale(true, "mkdir -p %s", maxscale_binlog_dir),
"Creating binlog data dir failed\n"); "Creating binlog data dir failed");
tprintf("Set 'maxscale' as a owner of binlog dir\n"); tprintf("Set 'maxscale' as a owner of binlog dir");
add_result(ssh_maxscale(false, add_result(ssh_maxscale(false,
"%s mkdir -p %s; %s chown maxscale:maxscale -R %s", "%s mkdir -p %s; %s chown maxscale:maxscale -R %s",
maxscale_access_sudo, maxscale_binlog_dir, maxscale_access_sudo, maxscale_binlog_dir,
maxscale_access_sudo, maxscale_binlog_dir), maxscale_access_sudo, maxscale_binlog_dir),
"directory ownership change failed\n"); "directory ownership change failed");
return 0; return 0;
} }