Merge branch '2.3' into develop

This commit is contained in:
Esa Korhonen
2019-04-24 13:29:04 +03:00
34 changed files with 774 additions and 681 deletions

View File

@ -1048,6 +1048,76 @@ add_test_executable(mxs2057_systemd_watchdog.cpp mxs2057_systemd_watchdog mxs205
############################################
# END: binlogrouter and avrorouter tests #
############################################
############################################
# BEGIN: tests with 15 machines backend #
############################################
# temporarily added UNSTABLE HEAVY labels to prevent execution of these tests in daily rounds
# own long test
# 'long_test_time' variable defines time of execution (in seconds)
#add_test_executable_notest(long_test.cpp long_test_big replication LABELS readwritesplit REPL_BACKEND BIG_REPL_BACKEND UNSTABLE HEAVY)
# Tries INSERTs with size close to 0x0ffffff * N
add_test_derived(different_size_rwsplit_big different_size_rwsplit replication LABELS readwritesplit UNSTABLE HEAVY REPL_BACKEND BIG_REPL_BACKEND UNSTABLE)
# Check how Maxscale works in case of one slave failure, only one slave is configured
add_test_derived(slave_failover_big slave_failover replication.one_slave LABELS readwritesplit REPL_BACKEND BIG_REPL_BACKEND UNSTABLE HEAVY)
# Execute queries of different size, check data is the same when accessing via Maxscale and directly to backend
add_test_derived(sql_queries_big sql_queries replication LABELS readwritesplit REPL_BACKEND BIG_REPL_BACKEND UNSTABLE HEAVY)
# Check temporal tables commands functionality
add_test_derived(temporal_tables_big temporal_tables replication LABELS readwritesplit REPL_BACKEND BIG_REPL_BACKEND UNSTABLE HEAVY)
# Check if prepared statement works via Maxscale (via RWSplit)
add_test_derived(prepared_statement_big prepared_statement replication LABELS readwritesplit REPL_BACKEND BIG_REPL_BACKEND UNSTABLE HEAVY)
# Connect to ReadConn in master mode and check if there is only one backend connection to master
add_test_derived(readconnrouter_master_big readconnrouter_master replication LABELS readconnroute REPL_BACKEND BIG_REPL_BACKEND UNSTABLE HEAVY)
# Creates 100 connections to ReadConn in slave mode and check if connections are distributed among all slaves
add_test_derived(readconnrouter_slave_big readconnrouter_slave replication LABELS readconnroute REPL_BACKEND BIG_REPL_BACKEND UNSTABLE HEAVY)
# Checks changes of COM_SELECT and COM_INSERT after queris to check if RWSplit sends queries to master or to slave depending on if it is write or read only query
add_test_derived(rw_select_insert_big rw_select_insert replication LABELS readwritesplit REPL_BACKEND BIG_REPL_BACKEND UNSTABLE HEAVY)
# Checks connections are distributed equaly among backends
add_test_derived(rwsplit_conn_num_big rwsplit_conn_num repl_lgc LABELS readwritesplit REPL_BACKEND BIG_REPL_BACKEND UNSTABLE HEAVY)
# Check that there is one connection to Master and one connection to one of slaves
add_test_derived(rwsplit_connect_big rwsplit_connect replication LABELS readwritesplit REPL_BACKEND BIG_REPL_BACKEND UNSTABLE HEAVY)
# Regression cases for the bug "Hint filter don't work if listed before regex filter in configuration file"
# (different filter sequence and configuration, but the same test, see .cnf for details)
add_test_derived(bug585_big bug587 bug585 LABELS regexfilter BIG_REPL_BACKEND REPL_BACKEND UNSTABLE)
add_test_derived(bug587_big bug587 bug587 LABELS regexfilter hintfilter BIG_REPL_BACKEND REPL_BACKEND UNSTABLE)
add_test_derived(bug587_1_big bug587 bug587_1 LABELS regexfilter hintfilter BIG_REPL_BACKEND REPL_BACKEND UNSTABLE)
# Regression case for the bug "Routing Hints route to server sometimes doesn't work"
add_test_derived(bug471_big bug471 bug471_big LABELS readwritesplit hintfilter BIG_REPL_BACKEND REPL_BACKEND UNSTABLE)
set_tests_properties(different_size_rwsplit_big PROPERTIES TIMEOUT 3600)
set_tests_properties(different_size_rwsplit PROPERTIES TIMEOUT 3600)
set_tests_properties(slave_failover_big PROPERTIES TIMEOUT 3600)
set_tests_properties(sql_queries_big PROPERTIES TIMEOUT 3600)
set_tests_properties(temporal_tables_big PROPERTIES TIMEOUT 3600)
set_tests_properties(prepared_statement_big PROPERTIES TIMEOUT 3600)
set_tests_properties(readconnrouter_master_big PROPERTIES TIMEOUT 3600)
set_tests_properties(readconnrouter_slave_big PROPERTIES TIMEOUT 3600)
set_tests_properties(rw_select_insert_big PROPERTIES TIMEOUT 3600)
set_tests_properties(rwsplit_conn_num_big PROPERTIES TIMEOUT 3600)
set_tests_properties(rwsplit_connect_big PROPERTIES TIMEOUT 3600)
set_tests_properties(bug585_big PROPERTIES TIMEOUT 3600)
set_tests_properties(bug587_big PROPERTIES TIMEOUT 3600)
set_tests_properties(bug587_1_big PROPERTIES TIMEOUT 3600)
set_tests_properties(bug471_big PROPERTIES TIMEOUT 3600)
############################################
# END: tests with 15 machines backend #
############################################
###############################
# DO NOT ADD TESTS AFTER THIS #
###############################

View File

@ -10,7 +10,7 @@ int main(int argc, char** argv)
{
MYSQL* mysql[1000];
TestConnections* Test = new TestConnections(argc, argv);
Test->stop_timeout();
Test->repl->execute_query_all_nodes((char*) "set global max_connections = 10;");
for (int x = 0; x < 3; x++)
@ -33,7 +33,7 @@ int main(int argc, char** argv)
// Wait for the connections to clean up
Test->stop_timeout();
sleep(5);
sleep(2 * Test->repl->N);
Test->check_maxscale_alive(0);
int rval = Test->global_result;

View File

@ -152,6 +152,7 @@ using namespace std;
int main(int argc, char* argv[])
{
TestConnections* Test = new TestConnections(argc, argv);
Test->repl->limit_nodes(Test->maxscales->get_backend_servers_num(0, "RW-Split-Router"));
Test->set_timeout(10);
Test->repl->connect();

View File

@ -72,6 +72,7 @@ using namespace std;
int main(int argc, char* argv[])
{
TestConnections* Test = new TestConnections(argc, argv);
Test->repl->limit_nodes(4);
Test->set_timeout(10);
Test->repl->connect();
Test->maxscales->connect_maxscale(0);

5
maxscale-system-test/cnf/maxscale.cnf.template.bug471 Executable file → Normal file
View File

@ -5,7 +5,7 @@ log_warning=1
[MySQL-Monitor]
type=monitor
module=mysqlmon
servers= server1,server3 ,server4
servers=server1,server3,server4
user=maxskysql
password= skysql
@ -22,7 +22,7 @@ replace=select
[RW-Split-Router]
type=service
router= readwritesplit
servers=server1, server2, server3,server4
servers=###server_line###
user=maxskysql
password=skysql
max_slave_connections=100%
@ -77,6 +77,7 @@ protocol=maxscaled
socket=default
[server1]
type=server
address=###node_server_IP_1###

View File

@ -0,0 +1,80 @@
[maxscale]
threads=###threads###
log_warning=1
[MySQL Monitor]
type=monitor
module=mysqlmon
servers=server1,server3,server4,server5,server6,server7,server8,server9,server10,server11,server12,server13,server14,server15
user=maxskysql
password= skysql
[hints]
type=filter
module=hintfilter
[regex]
type=filter
module=regexfilter
match=fetch
replace=select
[RW Split Router]
type=service
router= readwritesplit
servers=###server_line###
user=maxskysql
password=skysql
max_slave_connections=100%
use_sql_variables_in=all
slave_selection_criteria=LEAST_BEHIND_MASTER
filters=hints|regex
[Read Connection Router Slave]
type=service
router=readconnroute
router_options= slave
servers=server1,server2,server3,server4
user=maxskysql
password=skysql
[Read Connection Router Master]
type=service
router=readconnroute
router_options=master
servers=server1,server2,server3,server4
user=maxskysql
password=skysql
[RW Split Listener]
type=listener
service=RW Split Router
protocol=MySQLClient
port=4006
#socket=/tmp/rwsplit.sock
[Read Connection Listener Slave]
type=listener
service=Read Connection Router Slave
protocol=MySQLClient
port=4009
[Read Connection Listener Master]
type=listener
service=Read Connection Router Master
protocol=MySQLClient
port=4008
[CLI]
type=service
router=cli
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
socket=default
###server###

View File

@ -5,7 +5,7 @@ log_warning=1
[MySQL-Monitor]
type=monitor
module=mysqlmon
servers= server1, server2,server3 ,server4
servers=###server_line###
user=maxskysql
password= skysql
@ -24,7 +24,7 @@ replace=from
[RW-Split-Router]
type=service
router= readwritesplit
servers=server1, server2, server3,server4
servers=###server_line###
user=maxskysql
password=skysql
max_slave_connections=100%
@ -82,27 +82,4 @@ protocol=maxscaled
socket=default
[server1]
type=server
address=###node_server_IP_1###
port=###node_server_port_1###
protocol=MySQLBackend
[server2]
type=server
address=###node_server_IP_2###
port=###node_server_port_2###
protocol=MySQLBackend
[server3]
type=server
address=###node_server_IP_3###
port=###node_server_port_3###
protocol=MySQLBackend
[server4]
type=server
address=###node_server_IP_4###
port=###node_server_port_4###
protocol=MySQLBackend
###server###

View File

@ -5,7 +5,7 @@ log_warning=1
[MySQL-Monitor]
type=monitor
module=mysqlmon
servers= server1, server2,server3 ,server4
servers=###server_line###
user=maxskysql
password= skysql
@ -22,7 +22,7 @@ replace=select
[RW-Split-Router]
type=service
router= readwritesplit
servers=server1, server2, server3,server4
servers=###server_line###
user=maxskysql
password=skysql
max_slave_connections=100%
@ -76,27 +76,4 @@ protocol=maxscaled
socket=default
[server1]
type=server
address=###node_server_IP_1###
port=###node_server_port_1###
protocol=MySQLBackend
[server2]
type=server
address=###node_server_IP_2###
port=###node_server_port_2###
protocol=MySQLBackend
[server3]
type=server
address=###node_server_IP_3###
port=###node_server_port_3###
protocol=MySQLBackend
[server4]
type=server
address=###node_server_IP_4###
port=###node_server_port_4###
protocol=MySQLBackend
###server###

View File

@ -5,7 +5,7 @@ log_warning=1
[MySQL-Monitor]
type=monitor
module=mysqlmon
servers= server1, server2,server3 ,server4
servers=###server_line###
user=maxskysql
password= skysql
@ -22,7 +22,7 @@ replace=select
[RW-Split-Router]
type=service
router= readwritesplit
servers=server1, server2, server3,server4
servers=###server_line###
user=maxskysql
password=skysql
max_slave_connections=100%
@ -76,27 +76,4 @@ protocol=maxscaled
socket=default
[server1]
type=server
address=###node_server_IP_1###
port=###node_server_port_1###
protocol=MySQLBackend
[server2]
type=server
address=###node_server_IP_2###
port=###node_server_port_2###
protocol=MySQLBackend
[server3]
type=server
address=###node_server_IP_3###
port=###node_server_port_3###
protocol=MySQLBackend
[server4]
type=server
address=###node_server_IP_4###
port=###node_server_port_4###
protocol=MySQLBackend
###server###

View File

@ -5,7 +5,7 @@ log_warning=1
[MySQL-Monitor]
type=monitor
module=mysqlmon
servers= server1, server2,server3 ,server4
servers=###server_line###
user=maxskysql
password= skysql
monitor_interval=1000
@ -13,7 +13,7 @@ monitor_interval=1000
[RW-Split-Router]
type=service
router= readwritesplit
servers=server1, server2, server3,server4
servers=###server_line###
user=maxskysql
password=skysql
slave_selection_criteria=LEAST_GLOBAL_CONNECTIONS
@ -23,7 +23,7 @@ max_slave_connections=1
type=service
router=readconnroute
router_options= slave
servers=server1,server2,server3,server4
servers=###server_line###
user=maxskysql
password=skysql
@ -31,7 +31,7 @@ password=skysql
type=service
router=readconnroute
router_options=master
servers=server1,server2,server3,server4
servers=###server_line###
user=maxskysql
password=skysql
@ -65,27 +65,4 @@ protocol=maxscaled
#address=localhost
socket=default
[server1]
type=server
address=###node_server_IP_1###
port=###node_server_port_1###
protocol=MySQLBackend
[server2]
type=server
address=###node_server_IP_2###
port=###node_server_port_2###
protocol=MySQLBackend
[server3]
type=server
address=###node_server_IP_3###
port=###node_server_port_3###
protocol=MySQLBackend
[server4]
type=server
address=###node_server_IP_4###
port=###node_server_port_4###
protocol=MySQLBackend
###server###

View File

@ -0,0 +1,158 @@
[maxscale]
threads=###threads###
log_warning=1
[MySQL Monitor]
type=monitor
module=mysqlmon
servers=server1,server2,server3,server4,server5,server6,server7,server8,server9,server10,server11,server12,server13,server14,server15
user=maxskysql
password= skysql
monitor_interval=1000
[RW Split Router]
type=service
router= readwritesplit
servers=server1,server2,server3,server4,server5,server6,server7,server8,server9,server10,server11,server12,server13,server14,server15
user=maxskysql
password=skysql
slave_selection_criteria=LEAST_GLOBAL_CONNECTIONS
max_slave_connections=1
[Read Connection Router Slave]
type=service
router=readconnroute
router_options= slave
servers=server1,server2,server3,server4,server5,server6,server7,server8,server9,server10,server11,server12,server13,server14,server15
user=maxskysql
password=skysql
[Read Connection Router Master]
type=service
router=readconnroute
router_options=master
servers=server1,server2,server3,server4,server5,server6,server7,server8,server9,server10,server11,server12,server13,server14,server15
user=maxskysql
password=skysql
[RW Split Listener]
type=listener
service=RW Split Router
protocol=MySQLClient
port=4006
#socket=/tmp/rwsplit.sock
[Read Connection Listener Slave]
type=listener
service=Read Connection Router Slave
protocol=MySQLClient
port=4009
[Read Connection Listener Master]
type=listener
service=Read Connection Router Master
protocol=MySQLClient
port=4008
[CLI]
type=service
router=cli
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
#address=localhost
socket=default
[server1]
type=server
address=###node_server_IP_1###
port=###node_server_port_1###
protocol=MySQLBackend
[server2]
type=server
address=###node_server_IP_2###
port=###node_server_port_2###
protocol=MySQLBackend
[server3]
type=server
address=###node_server_IP_3###
port=###node_server_port_3###
protocol=MySQLBackend
[server4]
type=server
address=###node_server_IP_4###
port=###node_server_port_4###
protocol=MySQLBackend
[server5]
type=server
address=###node_server_IP_5###
port=###node_server_port_5###
protocol=MySQLBackend
[server6]
type=server
address=###node_server_IP_6###
port=###node_server_port_6###
protocol=MySQLBackend
[server7]
type=server
address=###node_server_IP_7###
port=###node_server_port_7###
protocol=MySQLBackend
[server8]
type=server
address=###node_server_IP_8###
port=###node_server_port_8###
protocol=MySQLBackend
[server9]
type=server
address=###node_server_IP_9###
port=###node_server_port_9###
protocol=MySQLBackend
[server10]
type=server
address=###node_server_IP_10###
port=###node_server_port_10###
protocol=MySQLBackend
[server11]
type=server
address=###node_server_IP_11###
port=###node_server_port_11###
protocol=MySQLBackend
[server12]
type=server
address=###node_server_IP_12###
port=###node_server_port_12###
protocol=MySQLBackend
[server13]
type=server
address=###node_server_IP_13###
port=###node_server_port_13###
protocol=MySQLBackend
[server14]
type=server
address=###node_server_IP_14###
port=###node_server_port_14###
protocol=MySQLBackend
[server15]
type=server
address=###node_server_IP_15###
port=###node_server_port_15###
protocol=MySQLBackend

View File

@ -5,7 +5,7 @@ threads=###threads###
[MySQL-Monitor]
type=monitor
module=mysqlmon
servers=server1,server2,server3,server4
servers=###server_line###
user=maxskysql
password=skysql
monitor_interval=1000
@ -15,7 +15,7 @@ detect_standalone_master=false
[RW-Split-Router]
type=service
router=readwritesplit
servers=server1,server2,server3,server4
servers=###server_line###
user=maxskysql
password=skysql
slave_selection_criteria=LEAST_GLOBAL_CONNECTIONS
@ -25,7 +25,7 @@ max_slave_connections=1
type=service
router=readconnroute
router_options=slave
servers=server1,server2,server3,server4
servers=###server_line###
user=maxskysql
password=skysql
@ -33,7 +33,7 @@ password=skysql
type=service
router=readconnroute
router_options=master
servers=server1,server2,server3,server4
servers=###server_line###
user=maxskysql
password=skysql
@ -65,26 +65,4 @@ service=CLI
protocol=maxscaled
socket=default
[server1]
type=server
address=###node_server_IP_1###
port=###node_server_port_1###
protocol=MySQLBackend
[server2]
type=server
address=###node_server_IP_2###
port=###node_server_port_2###
protocol=MySQLBackend
[server3]
type=server
address=###node_server_IP_3###
port=###node_server_port_3###
protocol=MySQLBackend
[server4]
type=server
address=###node_server_IP_4###
port=###node_server_port_4###
protocol=MySQLBackend
###server###

View File

@ -5,7 +5,7 @@ log_warning=1
[MySQL-Monitor]
type=monitor
module=mysqlmon
servers=server1,server2,server3,server4
servers=###server_line###
user=maxskysql
password=skysql
@ -13,7 +13,7 @@ password=skysql
type=service
router=readwritesplit
max_slave_connections=1
servers=server1,server2,server3,server4
servers=###server_line###
user=maxskysql
password=skysql
disable_sescmd_history=false
@ -22,7 +22,7 @@ disable_sescmd_history=false
type=service
router=readconnroute
router_options=slave
servers=server1,server2,server3,server4
servers=###server_line###
user=maxskysql
password=skysql
@ -30,7 +30,7 @@ password=skysql
type=service
router=readconnroute
router_options=master
servers=server1,server2,server3,server4
servers=###server_line###
user=maxskysql
password=skysql
@ -63,27 +63,4 @@ service=CLI
protocol=maxscaled
socket=default
[server1]
type=server
address=###node_server_IP_1###
port=###node_server_port_1###
protocol=MySQLBackend
[server2]
type=server
address=###node_server_IP_2###
port=###node_server_port_2###
protocol=MySQLBackend
[server3]
type=server
address=###node_server_IP_3###
port=###node_server_port_3###
protocol=MySQLBackend
[server4]
type=server
address=###node_server_IP_4###
port=###node_server_port_4###
protocol=MySQLBackend
###server###

View File

@ -64,11 +64,11 @@ void set_max_packet(TestConnections* Test, bool binlog, char* cmd)
void different_packet_size(TestConnections* Test, bool binlog)
{
Test->set_timeout(60);
Test->set_timeout(180);
Test->tprintf("Set big max_allowed_packet\n");
set_max_packet(Test, binlog, (char*) "set global max_allowed_packet = 200000000;");
Test->set_timeout(40);
Test->set_timeout(120);
Test->tprintf("Create table\n");
MYSQL* conn = connect_to_serv(Test, binlog);
Test->try_query(conn,
@ -85,7 +85,7 @@ void different_packet_size(TestConnections* Test, bool binlog)
{
size_t size = 0x0ffffff * i + j;
Test->tprintf("Trying event app. %lu bytes", size);
Test->set_timeout(300);
Test->set_timeout(1000);
char* event = create_event_size(size);
conn = connect_to_serv(Test, binlog);
@ -96,11 +96,11 @@ void different_packet_size(TestConnections* Test, bool binlog)
}
}
Test->set_timeout(40);
Test->set_timeout(120);
Test->tprintf("Restoring max_allowed_packet");
set_max_packet(Test, binlog, (char*) "set global max_allowed_packet = 1048576;");
Test->set_timeout(300);
Test->set_timeout(1000);
conn = connect_to_serv(Test, binlog);
Test->try_query(conn, "DROP TABLE test.large_event");
mysql_close(conn);

View File

@ -7,17 +7,12 @@
std::string get_mdbci_lables(const char *labels_string)
{
std::string mdbci_labels("MAXSCALE");
for (size_t i = 0; i < sizeof(labels_table) / sizeof(labels_table_t); i++)
{
if (TestConnections::verbose)
std::string test_label = std::string(";") + labels_table[i].test_label;
if (strstr(labels_string, test_label.c_str()))
{
printf("%lu\t %s\n", i, labels_table[i].test_label);
}
if (strstr(labels_string, labels_table[i].test_label))
{
mdbci_labels += "," + std::string(labels_table[i].mdbci_label);
mdbci_labels += "," + labels_table[i].mdbci_label;
}
}

View File

@ -4,14 +4,15 @@
struct labels_table_t
{
const char* test_label;
const char* mdbci_label;
std::string test_label;
std::string mdbci_label;
};
const labels_table_t labels_table [] __attribute__((unused)) =
{
{"REPL_BACKEND", "REPL_BACKEND"},
{"BIG_REPL_BACKEND", "BIG_REPL_BACKEND"},
{"GALERA_BACKEND", "GALERA_BACKEND"},
{"TWO_MAXSCALES", "SECOND_MAXSCALE"},
{"COLUMNSTORE_BACKEND", "COLUMNSTORE_BACKEND"},

View File

@ -51,6 +51,15 @@ Mariadb_nodes::Mariadb_nodes(const char *pref, const char *test_cwd, bool verbos
truncate_mariadb_logs();
flush_hosts();
close_active_connections();
cnf_server_name = std::string(prefix);
if (strcmp(prefix, "node") == 0)
{
cnf_server_name = std::string("server");
}
if (strcmp(prefix, "galera") == 0)
{
cnf_server_name = std::string("gserver");
}
}
Mariadb_nodes::~Mariadb_nodes()
@ -1465,3 +1474,43 @@ void Mariadb_nodes::replicate_from(int slave, const std::string& host, uint16_t
execute_query(nodes[slave], "%s", change_master.str().c_str());
execute_query(nodes[slave], "START SLAVE;");
}
void Mariadb_nodes::limit_nodes(int new_N)
{
if (N > new_N)
{
execute_query_all_nodes((char*) "stop slave;");
N = new_N;
fix_replication();
sleep(10);
}
}
std::string Mariadb_nodes::cnf_servers()
{
std::string s;
for (int i = 0; i < N; i++)
{
s += std::string("\\n[") +
cnf_server_name +
std::to_string(i + 1) +
std::string("]\\ntype=server\\naddress=") +
std::string(IP[i]) +
std::string("\\nport=") +
std::to_string(port[i]) +
std::string("\\nprotocol=MySQLBackend\\n");
}
return s;
}
std::string Mariadb_nodes::cnf_servers_line()
{
std::string s = cnf_server_name + std::to_string(1);
for (int i = 1; i < N; i++)
{
s += std::string(",") +
cnf_server_name +
std::to_string(i + 1);
}
return s;
}

View File

@ -480,6 +480,29 @@ public:
// Replicates from a host and a port instead of a known server
void replicate_from(int slave, const std::string& host, uint16_t port, const char* type = "current_pos");
/**
* @brief limit_nodes Restart replication for only new_N nodes
* @param new_N new number of nodes in replication
*/
void limit_nodes(int new_N);
/**
* @brief cnf_servers Generates backend servers description for maxscale.cnf
* @return Servers description including IPs, ports
*/
std::string cnf_servers();
/**
* @brief cnf_servers_line Generates list of backend servers for serivces definition in maxscale.cnf
* @return List of servers, e.g server1,server2,server3,...
*/
std::string cnf_servers_line();
/**
* @brief cnf_server_name Prefix for backend server name ('server', 'gserver')
*/
std::string cnf_server_name;
private:
bool check_master_node(MYSQL* conn);

View File

@ -332,6 +332,21 @@ int Maxscales::get_maxadmin_param(int m, const char* command, const char* param,
return exit_code;
}
int Maxscales::get_backend_servers_num(int m, const char* service)
{
char* buf;
int exit_code;
int i = 0;
buf = ssh_node_output_f(m, true, &exit_code, "maxadmin show service %s | grep Name: | grep Protocol: | wc -l", service);
if (buf && !exit_code)
{
sscanf(buf, "%d", &i);
}
return i;
}
long unsigned Maxscales::get_maxscale_memsize(int m)
{

View File

@ -21,7 +21,7 @@ public:
};
Maxscales(const char *pref, const char *test_cwd, bool verbose, bool use_valgrind,
std::__cxx11::string network_config);
std::string network_config);
int read_env();
@ -288,8 +288,17 @@ public:
int check_maxadmin_param(int m, const char* command, const char* param, const char* value);
int get_maxadmin_param(int m, const char* command, const char* param, char* result);
/**
* @brief get_backend_servers_num Gets number of backend servers configure for service
* @param m Number of Maxscale node
* @param service Name of service to ask
* @return number of backend servers
*/
int get_backend_servers_num(int m, const char* service);
/**
* @brief get_maxscale_memsize Gets size of the memory consumed by Maxscale process
* @param m Number of Maxscale node
* @return memory size in kilobytes
*/
long unsigned get_maxscale_memsize(int m = 0);

View File

@ -1,192 +0,0 @@
{
"node_000" :
{
"hostname" : "node000",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server1.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_001" :
{
"hostname" : "node001",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server2.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_002" :
{
"hostname" : "node002",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server3.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_003" :
{
"hostname" : "node003",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server4.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_004" :
{
"hostname" : "node004",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server5.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_005" :
{
"hostname" : "node005",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server6.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_006" :
{
"hostname" : "node006",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server7.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_007" :
{
"hostname" : "node007",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server8.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"galera_000" :
{
"hostname" : "galera000",
"box" : "centos_7_aws",
"labels" : [
"GALERA_BACKEND"
],
"product" : {
"name": "galera",
"version": "${galera_version}",
"cnf_template" : "galera_server1.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"galera_001" :
{
"hostname" : "galera001",
"box" : "centos_7_aws",
"labels" : [
"GALERA_BACKEND"
],
"product" : {
"name": "galera",
"version": "${galera_version}",
"cnf_template" : "galera_server2.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"galera_002" :
{
"hostname" : "galera002",
"box" : "centos_7_aws",
"labels" : [
"GALERA_BACKEND"
],
"product" : {
"name": "galera",
"version": "${galera_version}",
"cnf_template" : "galera_server3.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"galera_003" :
{
"hostname" : "galera003",
"box" : "centos_7_aws",
"labels" : [
"GALERA_BACKEND"
],
"product" : {
"name": "galera",
"version": "${galera_version}",
"cnf_template" : "galera_server4.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"maxscale_000" :
{
"hostname" : "maxscale",
"box" : "centos_7_aws_large",
"labels" : [
"MAXSCALE"
],
"product" : {
"name" : "maxscale_ci",
"version" : "${target}"
}
}
}

View File

@ -1,290 +0,0 @@
{
"node_000" :
{
"hostname" : "node_000",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server1.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_001" :
{
"hostname" : "node_001",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server2.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_002" :
{
"hostname" : "node_002",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server3.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_003" :
{
"hostname" : "node_003",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server4.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_004" :
{
"hostname" : "node_004",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server5.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_005" :
{
"hostname" : "node_005",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server6.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_006" :
{
"hostname" : "node_006",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server7.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_007" :
{
"hostname" : "node_007",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server8.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_008" :
{
"hostname" : "node_008",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server9.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_009" :
{
"hostname" : "node_009",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server10.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_010" :
{
"hostname" : "node_0010",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server11.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_011" :
{
"hostname" : "node_0011",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server12.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_012" :
{
"hostname" : "node_0012",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server13.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_013" :
{
"hostname" : "node_0013",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server14.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_014" :
{
"hostname" : "node_0014",
"box" : "centos_7_aws_large",
"labels" : [
"REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server15.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"galera_000" :
{
"hostname" : "galera_000",
"box" : "centos_7_aws",
"labels" : [
"GALERA_BACKEND"
],
"product" : {
"name": "galera",
"version": "${galera_version}",
"cnf_template" : "galera_server1.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"galera_001" :
{
"hostname" : "galera_001",
"box" : "centos_7_aws",
"labels" : [
"GALERA_BACKEND"
],
"product" : {
"name": "galera",
"version": "${galera_version}",
"cnf_template" : "galera_server2.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"galera_002" :
{
"hostname" : "galera_002",
"box" : "centos_7_aws",
"labels" : [
"GALERA_BACKEND"
],
"product" : {
"name": "galera",
"version": "${galera_version}",
"cnf_template" : "galera_server3.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"galera_003" :
{
"hostname" : "galera_003",
"box" : "centos_7_aws",
"labels" : [
"GALERA_BACKEND"
],
"product" : {
"name": "galera",
"version": "${galera_version}",
"cnf_template" : "galera_server4.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"maxscale_000" :
{
"hostname" : "maxscale",
"box" : "centos_7_aws_large",
"labels" : [
"MAXSCALE"
],
"product" : {
"name" : "maxscale_ci",
"version" : "${target}"
}
}
}

View File

@ -64,6 +64,182 @@
}
},
"node_004" :
{
"hostname" : "node004",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server5.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_005" :
{
"hostname" : "node005",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server6.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_006" :
{
"hostname" : "node006",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server7.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_007" :
{
"hostname" : "node007",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server8.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_008" :
{
"hostname" : "node008",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server9.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_009" :
{
"hostname" : "node009",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server10.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_010" :
{
"hostname" : "node010",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server11.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_011" :
{
"hostname" : "node011",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server12.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_012" :
{
"hostname" : "node012",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server13.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_013" :
{
"hostname" : "node013",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server14.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"node_014" :
{
"hostname" : "node013",
"box" : "${backend_box}",
"memory_size" : "${vm_memory}",
"labels" : [
"BIG_REPL_BACKEND"
],
"product" : {
"name": "${product}",
"version": "${version}",
"cnf_template" : "server15.cnf",
"cnf_template_path": "${cnf_path}"
}
},
"galera_000" :
{
"hostname" : "galera000",

View File

@ -18,7 +18,7 @@ using namespace std;
void test_basic(TestConnections& test)
{
test.set_timeout(60);
test.set_timeout(20 * test.repl->N);
int N = 4;
test.repl->connect();
@ -27,7 +27,7 @@ void test_basic(TestConnections& test)
create_t1(test.maxscales->conn_rwsplit[0]);
insert_into_t1(test.maxscales->conn_rwsplit[0], N);
test.set_timeout(20);
test.set_timeout(10 * test.repl->N);
test.try_query(test.maxscales->conn_rwsplit[0], "PREPARE stmt FROM 'SELECT * FROM t1 WHERE fl=@x;';");
test.try_query(test.maxscales->conn_rwsplit[0], "SET @x = 3;");
test.try_query(test.maxscales->conn_rwsplit[0], "EXECUTE stmt");
@ -40,7 +40,7 @@ void test_basic(TestConnections& test)
void test_routing(TestConnections& test)
{
test.set_timeout(60);
test.set_timeout(20 * test.repl->N);
test.repl->connect();
int server_id = test.repl->get_server_id(0);
test.maxscales->connect_maxscale(0);
@ -87,6 +87,7 @@ void test_routing(TestConnections& test)
test.try_query(test.maxscales->conn_rwsplit[0], "PREPARE ps2 FROM 'INSERT INTO test.t1 VALUES (?)'");
test.try_query(test.maxscales->conn_rwsplit[0], "SET @a = @@server_id");
test.try_query(test.maxscales->conn_rwsplit[0], "EXECUTE ps2 USING @a");
test.set_timeout(30 * test.repl->N);
test.repl->sync_slaves();
test.add_result(find_field(test.maxscales->conn_rwsplit[0], "SELECT id FROM test.t1", "id", buf),
"Read should succeed");

View File

@ -7,7 +7,7 @@
int main(int argc, char* argv[])
{
TestConnections test(argc, argv);
test.set_timeout(100);
test.set_timeout(25 * test.repl->N);
test.repl->connect();
test.tprintf("Connecting to ReadConnnRouter in 'master' mode");
@ -18,13 +18,13 @@ int main(int argc, char* argv[])
test.maxscales->close_readconn_master(0);
test.tprintf("Changing master to node 1");
test.set_timeout(50);
test.set_timeout(20 * test.repl->N);
test.repl->change_master(1, 0);
test.stop_timeout();
test.maxscales->wait_for_monitor();
test.tprintf("Connecting to ReadConnnRouter in 'master' mode");
test.set_timeout(50);
test.set_timeout(20 * test.repl->N);
test.maxscales->connect_readconn_master(0);
master = get_row(test.repl->nodes[1], "SELECT @@server_id");
maxscale = get_row(test.maxscales->conn_master[0], "SELECT @@server_id");

View File

@ -15,7 +15,7 @@ using namespace std;
int main(int argc, char* argv[])
{
TestConnections* Test = new TestConnections(argc, argv);
Test->set_timeout(100);
Test->set_timeout(25 * Test->repl->N);
Test->repl->connect();
const int TestConnNum = 100;
@ -26,8 +26,10 @@ int main(int argc, char* argv[])
Test->tprintf("Creating %d connections to ReadConnRouter in 'slave' mode\n", TestConnNum);
for (i = 0; i < TestConnNum; i++)
{
Test->set_timeout(10 * Test->repl->N);
conn[i] = Test->maxscales->open_readconn_slave_connection(0);
}
Test->set_timeout(25 * Test->repl->N);
Test->tprintf("Waiting 5 seconds\n");
sleep(5);

View File

@ -40,8 +40,10 @@ int main(int argc, char* argv[])
{
conn[i] = Test->maxscales->open_rwsplit_connection(0);
}
Test->tprintf("Waiting 5 seconds\n");
sleep(5);
Test->tprintf("Waiting %d seconds\n", 2 * Test->repl->N);
Test->stop_timeout();
sleep(2 * Test->repl->N);
Test->set_timeout(30);
int ConnFloor = floor((float)TestConnNum / (Test->repl->N - 1));
int ConnCell = ceil((float)TestConnNum / (Test->repl->N - 1));
@ -61,6 +63,7 @@ int main(int argc, char* argv[])
Test->tprintf("Checking connections to each node\n");
for (int i = 1; i < Test->repl->N; i++)
{
Test->set_timeout(20);
conn_num =
get_conn_num(Test->repl->nodes[i],
Test->maxscales->ip(0),

View File

@ -64,6 +64,7 @@ int main(int argc, char* argv[])
for (i = 0; i < iterations; i++)
{
Test->set_timeout(30);
Test->tprintf("Connection to backend\n");
Test->repl->connect();
Test->tprintf("Connection to Maxscale\n");
@ -80,8 +81,10 @@ int main(int argc, char* argv[])
Test->try_query(Test->maxscales->conn_rwsplit[0], "DROP TABLE t1");
Test->try_query(Test->maxscales->conn_rwsplit[0], "DROP DATABASE IF EXISTS test1;");
Test->try_query(Test->maxscales->conn_rwsplit[0], "CREATE DATABASE test1;");
Test->set_timeout(10 * Test->repl->N);
Test->repl->sync_slaves();
Test->set_timeout(30);
Test->tprintf("Testing with database 'test1'\n");
Test->add_result(Test->use_db(0, (char*) "test1"), "use_db failed\n");
Test->add_result(Test->insert_select(0, N), "insert-select check failed\n");

View File

@ -22,7 +22,7 @@ int main(int argc, char* argv[])
test.maxscales->connect_maxscale(0);
test.tprintf("Create a table and insert two rows into it");
test.set_timeout(30);
test.set_timeout(10 * test.repl->N);
execute_query(test.maxscales->conn_rwsplit[0], "USE test");
create_t1(test.maxscales->conn_rwsplit[0]);
@ -30,14 +30,14 @@ int main(int argc, char* argv[])
execute_query(test.maxscales->conn_rwsplit[0], "INSERT INTO t1 (x1, fl) VALUES(1, 1)");
test.tprintf("Create temporary table and insert one row");
test.set_timeout(30);
test.set_timeout(10 * test.repl->N);
execute_query(test.maxscales->conn_rwsplit[0],
"create temporary table t1 as (SELECT * FROM t1 WHERE fl=3)");
execute_query(test.maxscales->conn_rwsplit[0], "INSERT INTO t1 (x1, fl) VALUES(0, 1)");
test.tprintf("Check that the temporary table has one row");
test.set_timeout(90);
test.set_timeout(25 * test.repl->N);
test.add_result(execute_select_query_and_check(test.maxscales->conn_rwsplit[0], "SELECT * FROM t1", 1),
"Current connection should show one row");
@ -47,7 +47,7 @@ int main(int argc, char* argv[])
"New connection should show two rows");
printf("Drop temporary table and check that the real table has two rows");
test.set_timeout(90);
test.set_timeout(25 * test.repl->N);
execute_query(test.maxscales->conn_rwsplit[0], "DROP TABLE t1");
test.add_result(execute_select_query_and_check(test.maxscales->conn_rwsplit[0], "SELECT * FROM t1", 2),

View File

@ -284,6 +284,7 @@ TestConnections::TestConnections(int argc, char* argv[])
const char * labels_string = NULL;
template_name = get_template_name(test_name, &labels_string);
tprintf("testname: '%s', template: '%s'", test_name, template_name);
labels = strstr(labels_string, "LABELS;");
if (!labels)
{
@ -788,6 +789,11 @@ void TestConnections::process_template(int m, const char* template_name, const c
system(str);
}
sprintf(str, "sed -i \"s/###%s###/%s/\" maxscale.cnf", mdn[j]->cnf_server_name.c_str(), mdn[j]->cnf_servers().c_str());
system(str);
sprintf(str, "sed -i \"s/###%s_line###/%s/\" maxscale.cnf", mdn[j]->cnf_server_name.c_str(), mdn[j]->cnf_servers_line().c_str());
system(str);
mdn[j]->connect();
execute_query(mdn[j]->nodes[0], (char *) "CREATE DATABASE IF NOT EXISTS test");
mdn[j]->close_connections();