Clean up mxs812_1
Use stack allocated objects, reduce the iteration count and the amount of sent data (now roughly 10MB in total).
This commit is contained in:
parent
8b736854e8
commit
df3deb25cb
@ -6,77 +6,64 @@
|
||||
* - execute statement
|
||||
* - wait 5 seconds
|
||||
* - check "Current no. of conns" maxadmin output, expect 0
|
||||
* - repeat test 10 times
|
||||
* - repeat test 2 times
|
||||
*/
|
||||
|
||||
|
||||
#include "testconnections.h"
|
||||
|
||||
void run_test(TestConnections *Test, size_t size, int chunks)
|
||||
void run_test(TestConnections& test, size_t size, int chunks)
|
||||
{
|
||||
char *insert_stmt = (char *) "INSERT INTO long_blob_table(x, b) VALUES(1, ?)";
|
||||
MYSQL *conn = Test->maxscales->conn_rwsplit[0];
|
||||
MYSQL_STMT * stmt = mysql_stmt_init(conn);
|
||||
test.set_timeout(600);
|
||||
const char* insert_stmt = "INSERT INTO long_blob_table(x, b) VALUES(1, ?)";
|
||||
MYSQL* conn = test.maxscales->conn_rwsplit[0];
|
||||
MYSQL_STMT* stmt = mysql_stmt_init(conn);
|
||||
|
||||
Test->tprintf("Preparing statement");
|
||||
Test->add_result(mysql_stmt_prepare(stmt, insert_stmt, strlen(insert_stmt)), "Error preparing stmt: %s\n",
|
||||
mysql_stmt_error(stmt));
|
||||
test.add_result(mysql_stmt_prepare(stmt, insert_stmt, strlen(insert_stmt)),
|
||||
"Error preparing stmt: %s", mysql_stmt_error(stmt));
|
||||
|
||||
MYSQL_BIND param[1];
|
||||
param[0].buffer_type = MYSQL_TYPE_STRING;
|
||||
param[0].is_null = 0;
|
||||
MYSQL_BIND param;
|
||||
param.buffer_type = MYSQL_TYPE_STRING;
|
||||
param.is_null = 0;
|
||||
|
||||
Test->add_result(mysql_stmt_bind_param(stmt, param), "Error parameter binding: %s\n", mysql_stmt_error(stmt));
|
||||
test.add_result(mysql_stmt_bind_param(stmt, ¶m),
|
||||
"Binding parameter failed: %s", mysql_stmt_error(stmt));
|
||||
|
||||
unsigned long *data = (unsigned long *) malloc(size * sizeof(long int));
|
||||
std::string data(size, '.');
|
||||
test.tprintf("Sending %d x %d bytes of data", size, chunks);
|
||||
|
||||
memset(data, '.', size * sizeof(long int));
|
||||
|
||||
Test->tprintf("Sending %d x %d bytes of data", size, chunks);
|
||||
for (int i = 0; i < chunks; i++)
|
||||
{
|
||||
Test->set_timeout(600);
|
||||
Test->tprintf("Chunk #%d\n", i);
|
||||
if (mysql_stmt_send_long_data(stmt, 0, (char *) data, size * sizeof(long int)) != 0)
|
||||
{
|
||||
Test->add_result(1, "Error inserting data, iteration %d, error %s\n", i, mysql_stmt_error(stmt));
|
||||
return;
|
||||
}
|
||||
test.add_result(mysql_stmt_send_long_data(stmt, 0, data.c_str(), data.size()),
|
||||
"Error inserting data, iteration %d, error %s", i, mysql_stmt_error(stmt));
|
||||
}
|
||||
|
||||
Test->set_timeout(600);
|
||||
Test->tprintf("Executing statement");
|
||||
Test->add_result(mysql_stmt_execute(stmt), "INSERT Statement with BLOB failed, error is %s\n",
|
||||
mysql_stmt_error(stmt));
|
||||
test.set_timeout(600);
|
||||
test.add_result(mysql_stmt_execute(stmt), "Execute failed: %s", mysql_stmt_error(stmt));
|
||||
|
||||
Test->stop_timeout();
|
||||
test.stop_timeout();
|
||||
sleep(5);
|
||||
Test->check_current_operations(0, 0);
|
||||
Test->tprintf("Closing statement");
|
||||
Test->add_result(mysql_stmt_close(stmt), "Error closing stmt\n");
|
||||
test.check_current_operations(0, 0);
|
||||
test.add_result(mysql_stmt_close(stmt), "Closing statement failed: %s", mysql_stmt_error(stmt));
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
TestConnections * Test = new TestConnections(argc, argv);
|
||||
Test->set_timeout(300);
|
||||
int iter = 10;
|
||||
TestConnections test(argc, argv);
|
||||
test.repl->execute_query_all_nodes("set global max_allowed_packet=10000000");
|
||||
|
||||
Test->repl->execute_query_all_nodes( (char *) "set global max_allowed_packet=10000000");
|
||||
test.repl->connect();
|
||||
test.try_query(test.repl->nodes[0], "DROP TABLE IF EXISTS long_blob_table");
|
||||
test.try_query(test.repl->nodes[0], "CREATE TABLE long_blob_table(x INT, b LONGBLOB)");
|
||||
test.repl->sync_slaves();
|
||||
|
||||
/** Create test table */
|
||||
Test->repl->connect();
|
||||
Test->try_query(Test->repl->nodes[0], (char*)"DROP TABLE IF EXISTS long_blob_table");
|
||||
Test->try_query(Test->repl->nodes[0], (char*)"CREATE TABLE long_blob_table(x INT, b LONGBLOB)");
|
||||
test.maxscales->connect();
|
||||
|
||||
Test->maxscales->connect_maxscale(0);
|
||||
Test->tprintf("Starting test");
|
||||
for (int i = 0; i < iter; i++)
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
run_test(Test, 500000, 10);
|
||||
run_test(test, 500000, 10);
|
||||
}
|
||||
|
||||
int rval = Test->global_result;
|
||||
delete Test;
|
||||
return rval;
|
||||
test.maxscales->disconnect();
|
||||
|
||||
return test.global_result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user