Merge branch '2.1' into develop

This commit is contained in:
Markus Mäkelä
2017-09-20 10:47:53 +03:00
16 changed files with 278 additions and 60 deletions

View File

@ -481,6 +481,10 @@ add_test_executable(mxs1123.cpp mxs1123 mxs1123 LABELS maxscale REPL_BACKEND)
# https://jira.mariadb.org/browse/MXS-1319
add_test_executable(mxs1319.cpp mxs1319 replication LABELS MySQLAuth REPL_BACKEND)
# MXS-1418: Removing a server from a service breaks the connection
# https://jira.mariadb.org/browse/MXS-1418
add_test_executable(mxs1418.cpp mxs1418 replication LABELS maxscale REPL_BACKEND)
# 'namedserverfilter' test
add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND)

View File

@ -1,6 +1,8 @@
[maxscale]
threads=###threads###
log_info=1
auth_read_timeout=1
auth_connect_timeout=1
[MySQL Monitor]
type=monitor
@ -9,7 +11,9 @@ module=mysqlmon
servers= server1,server2
user=maxskysql
passwd= skysql
monitor_interval=500
monitor_interval=1000
backend_read_timeout=1
backend_connect_timeout=1
[RW Split Router]
type=service

View File

@ -18,7 +18,7 @@ std::string do_query(TestConnections& test)
{
MYSQL* conn = test.open_rwsplit_connection();
const char* query = "SELECT SLEEP(10), @@server_id";
const char* query = "SELECT SLEEP(15), @@server_id";
char output[512] = "";
find_field(conn, query, "@@server_id", output);
@ -38,11 +38,13 @@ int main(int argc, char *argv[])
test.repl->close_connections();
test.set_timeout(60);
test.add_result(do_query(test) != slave, "The slave should respond to the first query");
std::string res = do_query(test);
test.add_result(res != slave, "The slave should respond to the first query: %s", res.c_str());
pthread_t thr;
pthread_create(&thr, NULL, async_block, &test);
test.add_result(do_query(test) != master, "The master should respond to the second query");
res = do_query(test);
test.add_result(res != master, "The master should respond to the second query: %s", res.c_str());
pthread_join(thr, NULL);
test.repl->unblock_node(1);

View File

@ -0,0 +1,73 @@
/**
* @file Check that removing a server from a service doesn't break active connections
*/
#include "testconnections.h"
static volatile bool running = true;
void* thr(void* data)
{
TestConnections* test = (TestConnections*)data;
while (running && test->global_result == 0)
{
test->set_timeout(60);
if (test->try_query(test->conn_rwsplit, "SELECT 1"))
{
test->tprintf("Failed to select via readwritesplit");
}
if (test->try_query(test->conn_master, "SELECT 1"))
{
test->tprintf("Failed to select via readconnroute master");
}
if (test->try_query(test->conn_slave, "SELECT 1"))
{
test->tprintf("Failed to select via readconnroute slave");
}
}
test->stop_timeout();
return NULL;
}
int main(int argc, char *argv[])
{
TestConnections test(argc, argv);
test.connect_maxscale();
test.tprintf("Connect to MaxScale and continuously execute queries");
pthread_t thread;
pthread_create(&thread, NULL, thr, &test);
sleep(5);
test.tprintf("Remove all servers from all services");
for (int i = 3; i > -1; i--)
{
test.ssh_maxscale(true, "maxadmin remove server server%d \"RW Split Router\"", i);
test.ssh_maxscale(true, "maxadmin remove server server%d \"Read Connection Router Slave\"", i);
test.ssh_maxscale(true, "maxadmin remove server server%d \"Read Connection Router Master\"", i);
}
sleep(5);
test.tprintf("Stop queries and close the connections");
running = false;
pthread_join(thread, NULL);
test.close_maxscale_connections();
test.tprintf("Add all servers to all services");
for (int i = 3; i > -1; i--)
{
test.ssh_maxscale(true, "maxadmin add server server%d \"RW Split Router\"", i);
test.ssh_maxscale(true, "maxadmin add server server%d \"Read Connection Router Slave\"", i);
test.ssh_maxscale(true, "maxadmin add server server%d \"Read Connection Router Master\"", i);
}
test.check_maxscale_alive();
return test.global_result;
}