Update mxs431
Removed excessive output, tuned timeouts and removed unnecessary heap allocation of TestConnections.
This commit is contained in:
@ -5,62 +5,52 @@
|
|||||||
* - Connect repeatedly to MaxScale with 'testdb' as the default database and execute SELECT 1
|
* - Connect repeatedly to MaxScale with 'testdb' as the default database and execute SELECT 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include "testconnections.h"
|
#include "testconnections.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
TestConnections * Test = new TestConnections(argc, argv);
|
TestConnections test(argc, argv);
|
||||||
char str[256];
|
char str[256];
|
||||||
int iterations = Test->smoke ? 100 : 500;
|
int iterations = 100;
|
||||||
Test->repl->execute_query_all_nodes((char *) "set global max_connections = 600;");
|
test.repl->execute_query_all_nodes((char *) "set global max_connections = 600;");
|
||||||
Test->set_timeout(30);
|
test.set_timeout(30);
|
||||||
Test->repl->stop_slaves();
|
test.repl->stop_slaves();
|
||||||
Test->set_timeout(30);
|
test.set_timeout(30);
|
||||||
Test->restart_maxscale();
|
test.restart_maxscale();
|
||||||
Test->set_timeout(30);
|
test.set_timeout(30);
|
||||||
Test->repl->connect();
|
test.repl->connect();
|
||||||
Test->stop_timeout();
|
test.stop_timeout();
|
||||||
|
|
||||||
/** Create a database on each node */
|
/** Create a database on each node */
|
||||||
for (int i = 0; i < Test->repl->N; i++)
|
for (int i = 0; i < test.repl->N; i++)
|
||||||
{
|
{
|
||||||
Test->set_timeout(20);
|
test.set_timeout(20);
|
||||||
sprintf(str, "DROP DATABASE IF EXISTS shard_db%d", i);
|
sprintf(str, "DROP DATABASE IF EXISTS shard_db%d", i);
|
||||||
Test->tprintf("%s\n", str);
|
test.tprintf("%s\n", str);
|
||||||
execute_query(Test->repl->nodes[i], str);
|
execute_query(test.repl->nodes[i], str);
|
||||||
Test->set_timeout(20);
|
test.set_timeout(20);
|
||||||
sprintf(str, "CREATE DATABASE shard_db%d", i);
|
sprintf(str, "CREATE DATABASE shard_db%d", i);
|
||||||
Test->tprintf("%s\n", str);
|
test.tprintf("%s\n", str);
|
||||||
execute_query(Test->repl->nodes[i], str);
|
execute_query(test.repl->nodes[i], str);
|
||||||
Test->stop_timeout();
|
test.stop_timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
Test->repl->close_connections();
|
test.repl->close_connections();
|
||||||
|
|
||||||
for (int j = 0; j < iterations && Test->global_result == 0; j++)
|
for (int j = 0; j < iterations && test.global_result == 0; j++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Test->repl->N; i++)
|
for (int i = 0; i < test.repl->N && test.global_result == 0; i++)
|
||||||
{
|
{
|
||||||
sprintf(str, "shard_db%d", i);
|
sprintf(str, "shard_db%d", i);
|
||||||
Test->set_timeout(15);
|
test.set_timeout(30);
|
||||||
MYSQL *conn = open_conn_db(Test->rwsplit_port, Test->maxscale_IP,
|
MYSQL *conn = open_conn_db(test.rwsplit_port, test.maxscale_IP,
|
||||||
str, Test->maxscale_user,
|
str, test.maxscale_user,
|
||||||
Test->maxscale_password, Test->ssl);
|
test.maxscale_password, test.ssl);
|
||||||
Test->set_timeout(15);
|
test.set_timeout(30);
|
||||||
Test->tprintf("Trying DB %d\n", i);
|
test.add_result(execute_query(conn, "SELECT 1"), "Trying DB %d failed at %d", i, j);
|
||||||
if (execute_query(conn, "SELECT 1"))
|
|
||||||
{
|
|
||||||
Test->add_result(1, "Failed at %d\n", j);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
mysql_close(conn);
|
mysql_close(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int rval = Test->global_result;
|
|
||||||
delete Test;
|
return test.global_result;
|
||||||
return rval;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user