
commit 48a0b902b67da46f1eed4afa687bdcb56b59d02f Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Mon Dec 16 15:35:07 2019 +0200 Increase timouts in the mxs173_trottle_filter test commit 81d8083a89421a8004b8024d480ae0f35d715b86 Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Mon Dec 16 14:19:39 2019 +0200 Increase timeouts in max1071_maxrow test commit e1039c6132f0e9274b8801165f3f905ede7c9421 Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Mon Dec 16 00:06:53 2019 +0200 Remove hardcoded 'home/vagrant/' from all maxscale.cnf in system tests commit 28c8029e060afdcf5159bf802b13dcd5e484d9f1 Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Sun Dec 15 21:31:34 2019 +0200 Use private IP for Galera congiguration in maxscale-system-tests commit 66dc36cbf43a5fb92465df31e1295e82865be1fc Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Sun Dec 15 09:06:28 2019 +0200 Fix typos in fwf_*.cpp commit 44c7a4384ddf39596c0254c955aeb6c008a00a35 Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Sun Dec 15 09:05:26 2019 +0200 Fix typos in fwf_*.cpp commit 2649017611908a8b0d27090f49722947ac31c4f4 Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Sun Dec 15 09:03:41 2019 +0200 Fix typos in fwf_*.cpp commit 5cc87658523e8496eaab17700be8a821af5b0cde Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Sat Dec 14 23:54:53 2019 +0200 Fix typo in fwf_copy_rules.cpp commit fb1accc36cb9d79691469f63cb4535f3bc38dedd Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Sat Dec 14 23:52:51 2019 +0200 More hardcoded 'vagrant' removals commit 77e49d474b4abe767629ff87b01f08137773d761 Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Sat Dec 14 23:35:09 2019 +0200 Fix hardcoded 'vagrant' user in fwf* tests Several firewall filter tests has hardcoded 'vagrant' as a user name for access user on the VM. Changed to node->access_user. commit ed5ab1487f37822db6a7478f76c0f3652776c389 Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Sat Dec 14 22:50:35 2019 +0200 Fix IP vs IP_private Many tests use IP instead of IP_private which makes them failed in the AWS or GCloud environment. The same applies to get_conn_num() etc functions. commit 0558aac23d303a675dc12d05b1766e698753b444 Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Thu Aug 15 12:02:01 2019 +0300 fix IP -> IP_private for some mysqlmon* testst commit 5d9c70970d970eb995c8774d0088bd1c54ab76fe Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Sat Dec 14 20:20:51 2019 +0200 Replace IP to IP_private in the maxscale-system-tests commit b06cf3329af59ff100748691991213fe639f29e6 Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Tue Nov 19 11:52:33 2019 +0200 Remove spaces from value which were read from *_network_config MDBCI can put spaces around values in the *_network_config file which can cause ssh connection failures in the tests. To fix it removing all spaces from all values which were read from *_network_config commit b3904f019847ef1db9d4ec9714ad9ef869fa0b01 Author: Timofey Turenko <timofey.turenko@mariadb.com> Date: Thu Dec 12 23:36:31 2019 +0200 Increate default timeout for all system tests
351 lines
12 KiB
C++
351 lines
12 KiB
C++
/**
|
|
* @file bug529.cpp regression case for bug 529 ( "'Current no. of conns' not going down" )
|
|
*
|
|
* - create table, opens 50 connections for every router, fill table with data using these connections.
|
|
* - check number of connections to Master - failure if there are more then 100 connections to master.
|
|
* - close RWSptit and ReadConn master connections and check connections to master again.
|
|
* - create 50 ReadConn slave connection in parallel threads, execute "SELECT * FROM t1" ones for every
|
|
* connections, then
|
|
* start using one of connections to create "SELECT" load.
|
|
* - check number of connections to Master again, wait 5 seconds and check number of connections to
|
|
* master ones more time: now expecting 0 connections to master (fail if there is a least one connection to
|
|
* master).
|
|
* - close and reopens all ReadConn slave connections in the main thread and check connections to master again
|
|
* - close all connection in all threads, close parallel thread
|
|
* - do final 'connections to master' check
|
|
*/
|
|
|
|
/*
|
|
* lisu87 2014-09-08 16:50:29 UTC
|
|
* After starting maxscale and putting some traffic to it, the number of current connections to master server
|
|
* are still going up:
|
|
*
|
|
* Server 0x29e6330 (carlsberg)
|
|
* Server: xxx.xxx.xxx.xxx
|
|
* Status: Master, Running
|
|
* Protocol: MySQLBackend
|
|
* Port: 3306
|
|
* Node Id: -1
|
|
* Master Id: -1
|
|
* Repl Depth: -1
|
|
* Number of connections: 58
|
|
* Current no. of conns: 29
|
|
* Current no. of operations: 0
|
|
* Server 0x2948f60 (psy-carslave-1)
|
|
* Server: xxx.xxx.xxx.xxx
|
|
* Status: Slave, Running
|
|
* Protocol: MySQLBackend
|
|
* Port: 3306
|
|
* Node Id: -1
|
|
* Master Id: -1
|
|
* Repl Depth: -1
|
|
* Number of connections: 0
|
|
* Current no. of conns: 0
|
|
* Current no. of operations: 0
|
|
* Server 0x2948e60 (psy-carslave-2)
|
|
* Server: xxx.xxx.xxx.xxx
|
|
* Status: Slave, Running
|
|
* Protocol: MySQLBackend
|
|
* Port: 3306
|
|
* Node Id: -1
|
|
* Master Id: -1
|
|
* Repl Depth: -1
|
|
* Number of connections: 29
|
|
* Current no. of conns: 0
|
|
* Current no. of operations: 0
|
|
* Comment 1 Vilho Raatikka 2014-09-09 06:53:56 UTC
|
|
* Is the version release-1.0beta?
|
|
* Does any load cause this or does it require multiple parallel clients, for example?
|
|
* Comment 2 lisu87 2014-09-09 07:53:18 UTC
|
|
* The version is release-1.0beta.
|
|
*
|
|
* Even when just one short connection is made the counter of "Current no. of conns" goes up.
|
|
*
|
|
* Interesting thing is that the amount of current connections for my slave is always exactly two times
|
|
* smaller than "Number of connections":
|
|
*
|
|
* Server 0x1f51330 (carlsberg)
|
|
* Server: 172.16.76.8
|
|
* Status: Master, Running
|
|
* Protocol: MySQLBackend
|
|
* Port: 3306
|
|
* Node Id: -1
|
|
* Master Id: -1
|
|
* Repl Depth: -1
|
|
* Number of connections: 3278
|
|
* Current no. of conns: 1639
|
|
* Current no. of operations: 0
|
|
* Comment 3 lisu87 2014-09-11 09:54:34 UTC
|
|
* Any update on this one?
|
|
* Comment 4 Vilho Raatikka 2014-09-11 10:34:20 UTC
|
|
* The problem can't be reproduced with the code I'm working currently, and which will be the one where beta
|
|
* release will be refresed from. Thus, I'd wait till beta refresh is done and see if the problem still
|
|
* exists.
|
|
* Comment 5 lisu87 2014-09-11 10:47:32 UTC
|
|
* Thank you.
|
|
*
|
|
* And one more question: is it normal that even if SELECT query has been performed on skave the "Number of
|
|
* connections" counter for master increases too?
|
|
* Comment 6 Vilho Raatikka 2014-09-11 11:02:08 UTC
|
|
* (In reply to comment #5)
|
|
* > Thank you.
|
|
* >
|
|
* > And one more question: is it normal that even if SELECT query has been
|
|
* > performed on skave the "Number of connections" counter for master increases
|
|
* > too?
|
|
*
|
|
* When rwsplit listens port 3333 and when a command like :
|
|
*
|
|
* mysql -h 127.0.0.1 -P 3333 -u maxscaleuser -ppwd -e "select count(user) from mysql.user"
|
|
*
|
|
* is executed client connects to MaxScale:3333, and MaxScale connects to master and slave(s). So connection
|
|
* count increases in each of those backends despite of query type.
|
|
*
|
|
* If you already have a rwsplit session, no new connections should be created when new queries are executed.
|
|
* Comment 7 Vilho Raatikka 2014-09-11 12:34:26 UTC
|
|
* I built MaxScale from releaes-1.0beta-refresh branch and tested by running 5000 prepared statements in one
|
|
* session to MaxScale/RWSplit and executing 'show servers' in another window. During the run the number of
|
|
* current connections was 1 in each server and after the run all 'current' counters show 0.
|
|
*
|
|
* If you want me to try with some other use case, describe it and I'll give it a try.
|
|
* Comment 8 lisu87 2014-09-11 12:45:37 UTC
|
|
* Thanks, Vilho.
|
|
*
|
|
* I'm building maxscale from that branch now and will retest shortly.
|
|
* Comment 9 lisu87 2014-09-11 14:45:26 UTC
|
|
* Confirmed. It works fine with 1.0beta-refresh.
|
|
*
|
|
* Thank you!
|
|
* Comment 10 Vilho Raatikka 2014-09-22 10:11:06 UTC
|
|
* The problem reappeared later and was eventually fixed in release-1.0beta-refresh commit
|
|
* a41a8d6060c7b60e09686bea8124803f047d85ad
|
|
*
|
|
*/
|
|
|
|
// counting connection to all services
|
|
|
|
|
|
#include <iostream>
|
|
#include "testconnections.h"
|
|
#include "sql_t1.h"
|
|
|
|
using namespace std;
|
|
|
|
|
|
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
|
|
int exit_flag = 0;
|
|
int conn_N = 50;
|
|
|
|
TestConnections* Test;
|
|
|
|
void* parall_traffic(void* ptr);
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
|
|
Test = new TestConnections(argc, argv);
|
|
Test->set_timeout(120);
|
|
int i;
|
|
int num_conn = 0;
|
|
char sql[100];
|
|
|
|
pthread_t parall_traffic1;
|
|
|
|
MYSQL* conn;
|
|
MYSQL* rwsplit_conn[conn_N];
|
|
MYSQL* master_conn[conn_N];
|
|
MYSQL* slave_conn[conn_N];
|
|
|
|
Test->repl->connect();
|
|
|
|
conn = Test->maxscales->open_rwsplit_connection(0);
|
|
execute_query(conn, (char*) "USE test;");
|
|
create_t1(conn);
|
|
mysql_close(conn);
|
|
Test->tprintf("Table t1 is created\n");
|
|
|
|
for (i = 0; i < conn_N; i++)
|
|
{
|
|
Test->set_timeout(60);
|
|
rwsplit_conn[i] = Test->maxscales->open_rwsplit_connection(0);
|
|
master_conn[i] = Test->maxscales->open_readconn_master_connection(0);
|
|
slave_conn[i] = Test->maxscales->open_readconn_slave_connection(0);
|
|
sprintf(sql, "INSERT INTO t1 (x1, fl) VALUES(%d, 1);", i);
|
|
execute_query(rwsplit_conn[i], "%s", sql);
|
|
sprintf(sql, "INSERT INTO t1 (x1, fl) VALUES(%d, 2);", i);
|
|
execute_query(master_conn[i], "%s", sql);
|
|
fflush(stdout);
|
|
}
|
|
|
|
for (i = 0; i < Test->repl->N; i++)
|
|
{
|
|
Test->set_timeout(60);
|
|
num_conn =
|
|
get_conn_num(Test->repl->nodes[i],
|
|
Test->maxscales->IP_private[0],
|
|
Test->maxscales->hostname[0],
|
|
(char*) "test");
|
|
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
|
if ((i == 0) && (num_conn > 2 * conn_N))
|
|
{
|
|
Test->add_result(1, "too many connections to master\n");
|
|
}
|
|
}
|
|
|
|
Test->tprintf("Closing RWSptit and ReadConn master connections\n");
|
|
for (i = 0; i < conn_N; i++)
|
|
{
|
|
mysql_close(rwsplit_conn[i]);
|
|
mysql_close(master_conn[i]);
|
|
}
|
|
|
|
for (i = 0; i < Test->repl->N; i++)
|
|
{
|
|
Test->set_timeout(60);
|
|
num_conn =
|
|
get_conn_num(Test->repl->nodes[i],
|
|
Test->maxscales->IP_private[0],
|
|
Test->maxscales->hostname[0],
|
|
(char*) "test");
|
|
printf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
|
if ((i == 0) && (num_conn > 2 * conn_N))
|
|
{
|
|
Test->add_result(1, "too many connections to master\n");
|
|
}
|
|
}
|
|
|
|
Test->tprintf("Opening more connection to ReadConn slave in parallel thread\n");
|
|
|
|
pthread_create(¶ll_traffic1, NULL, parall_traffic, NULL);
|
|
|
|
for (i = 0; i < Test->repl->N; i++)
|
|
{
|
|
num_conn =
|
|
get_conn_num(Test->repl->nodes[i],
|
|
Test->maxscales->IP_private[0],
|
|
Test->maxscales->hostname[0],
|
|
(char*) "test");
|
|
printf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
|
if ((i == 0) && (num_conn > 2 * conn_N))
|
|
{
|
|
Test->add_result(1, "too many connections to master\n");
|
|
}
|
|
}
|
|
|
|
Test->stop_timeout();
|
|
Test->tprintf("Sleeping");
|
|
sleep(5);
|
|
|
|
for (i = 0; i < Test->repl->N; i++)
|
|
{
|
|
Test->set_timeout(60);
|
|
num_conn =
|
|
get_conn_num(Test->repl->nodes[i],
|
|
Test->maxscales->IP_private[0],
|
|
Test->maxscales->hostname[0],
|
|
(char*) "test");
|
|
printf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
|
if ((i == 0) && (num_conn != 0))
|
|
{
|
|
Test->add_result(1, "there are still connections to master\n");
|
|
}
|
|
}
|
|
|
|
printf("Closing ReadConn slave connections\n");
|
|
for (i = 0; i < conn_N; i++)
|
|
{
|
|
mysql_close(slave_conn[i]);
|
|
}
|
|
|
|
for (i = 0; i < Test->repl->N; i++)
|
|
{
|
|
Test->set_timeout(60);
|
|
num_conn =
|
|
get_conn_num(Test->repl->nodes[i],
|
|
Test->maxscales->IP_private[0],
|
|
Test->maxscales->hostname[0],
|
|
(char*) "test");
|
|
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
|
if ((i == 0) && (num_conn != 0))
|
|
{
|
|
Test->add_result(1, "there are still connections to master\n");
|
|
}
|
|
}
|
|
|
|
Test->tprintf("Opening ReadConn slave connections again\n");
|
|
for (i = 0; i < conn_N; i++)
|
|
{
|
|
Test->set_timeout(60);
|
|
slave_conn[i] = Test->maxscales->open_readconn_slave_connection(0);
|
|
sprintf(sql, "SELECT * FROM t1");
|
|
execute_query(slave_conn[i], "%s", sql);
|
|
fflush(stdout);
|
|
}
|
|
|
|
for (i = 0; i < Test->repl->N; i++)
|
|
{
|
|
Test->set_timeout(60);
|
|
num_conn =
|
|
get_conn_num(Test->repl->nodes[i],
|
|
Test->maxscales->IP_private[0],
|
|
Test->maxscales->hostname[0],
|
|
(char*) "test");
|
|
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
|
if ((i == 0) && (num_conn != 0))
|
|
{
|
|
Test->add_result(1, "there are still connections to master\n");
|
|
}
|
|
}
|
|
|
|
Test->tprintf("Closing ReadConn slave connections\n");
|
|
for (i = 0; i < conn_N; i++)
|
|
{
|
|
Test->set_timeout(20);
|
|
mysql_close(slave_conn[i]);
|
|
}
|
|
exit_flag = 1;
|
|
|
|
for (i = 0; i < Test->repl->N; i++)
|
|
{
|
|
Test->set_timeout(60);
|
|
num_conn =
|
|
get_conn_num(Test->repl->nodes[i],
|
|
Test->maxscales->IP_private[0],
|
|
Test->maxscales->hostname[0],
|
|
(char*) "test");
|
|
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
|
if ((i == 0) && (num_conn != 0))
|
|
{
|
|
Test->add_result(1, "there are still connections to master\n");
|
|
}
|
|
}
|
|
|
|
int rval = Test->global_result;
|
|
delete Test;
|
|
return rval;
|
|
}
|
|
|
|
|
|
void* parall_traffic(void* ptr)
|
|
{
|
|
MYSQL* slave_conn1[conn_N];
|
|
int i;
|
|
for (i = 0; i < conn_N; i++)
|
|
{
|
|
slave_conn1[i] = Test->maxscales->open_readconn_slave_connection(0);
|
|
execute_query(slave_conn1[i], "SELECT * FROM t1");
|
|
}
|
|
|
|
while (exit_flag == 0)
|
|
{
|
|
execute_query(slave_conn1[0], "SELECT * FROM t1");
|
|
}
|
|
for (i = 0; i < conn_N; i++)
|
|
{
|
|
mysql_close(slave_conn1[i]);
|
|
}
|
|
|
|
return NULL;
|
|
}
|