Merge branch '2.2' into develop
This commit is contained in:
@ -662,6 +662,22 @@ add_test_executable(mxs1743_rconn_bitmask.cpp mxs1743_rconn_bitmask mxs1743_rcon
|
||||
# https://jira.mariadb.org/browse/MXS-1751
|
||||
add_test_executable(mxs1751_available_when_donor_crash.cpp mxs1751_available_when_donor_crash mxs1751_available_when_donor_crash LABELS galeramon GALERA_BACKEND)
|
||||
|
||||
# MXS-1773: Failing LOAD DATA LOCAL INFILE confuses readwritesplit
|
||||
# https://jira.mariadb.org/browse/MXS-1773
|
||||
add_test_executable(mxs1773_failing_ldli.cpp mxs1773_failing_ldli replication LABELS readwritesplit REPL_BACKEND)
|
||||
|
||||
# MXS-1776: recursive COM_STMT_EXECUTE execution
|
||||
# https://jira.mariadb.org/browse/MXS-1776
|
||||
add_test_executable(mxs1776_ps_exec_hang.cpp mxs1776_ps_exec_hang replication LABELS readwritesplit REPL_BACKEND)
|
||||
|
||||
# MXS-1786: Hang with COM_STATISTICS
|
||||
# https://jira.mariadb.org/browse/MXS-1786
|
||||
add_test_executable(mxs1786_statistics.cpp mxs1786_statistics replication LABELS readwritesplit REPL_BACKEND)
|
||||
|
||||
# MXS-1787: Crash with PS: CALL p1((SELECT f1()), ?)
|
||||
# https://jira.mariadb.org/browse/MXS-1787
|
||||
add_test_executable(mxs1787_call_ps.cpp mxs1787_call_ps replication LABELS readwritesplit REPL_BACKEND)
|
||||
|
||||
# 'namedserverfilter' test
|
||||
add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND)
|
||||
|
||||
|
||||
@ -297,8 +297,7 @@ int main(int argc, char *argv[])
|
||||
create_t1(Test->maxscales->conn_rwsplit[0]);
|
||||
insert_into_t1(Test->maxscales->conn_rwsplit[0], 1);
|
||||
Test->stop_timeout();
|
||||
sleep(5);
|
||||
|
||||
Test->repl->sync_slaves();
|
||||
|
||||
Test->tprintf("**** Test 1 ****\n");
|
||||
|
||||
@ -316,7 +315,8 @@ int main(int argc, char *argv[])
|
||||
create_t1(Test->maxscales->conn_rwsplit[0]);
|
||||
insert_into_t1(Test->maxscales->conn_rwsplit[0], 3);
|
||||
Test->stop_timeout();
|
||||
sleep(5);
|
||||
Test->repl->sync_slaves();
|
||||
|
||||
|
||||
Test->tprintf("**** Test 2 ****\n");
|
||||
exp_rows[0] = 0;
|
||||
|
||||
22
maxscale-system-test/mxs1773_failing_ldli.cpp
Normal file
22
maxscale-system-test/mxs1773_failing_ldli.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* MXS-1773: Failing LOAD DATA LOCAL INFILE confuses readwritesplit
|
||||
*
|
||||
* https://jira.mariadb.org/browse/MXS-1773
|
||||
*/
|
||||
#include "testconnections.h"
|
||||
#include <functional>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
test.maxscales->connect();
|
||||
auto q = std::bind(execute_query, test.maxscales->conn_rwsplit[0], std::placeholders::_1);
|
||||
q("LOAD DATA LOCAL INFILE '/tmp/this-file-does-not-exist.txt' INTO TABLE this_table_does_not_exist");
|
||||
q("SELECT 1");
|
||||
q("SELECT 2");
|
||||
q("SELECT 3");
|
||||
test.maxscales->disconnect();
|
||||
|
||||
return test.global_result;
|
||||
}
|
||||
193
maxscale-system-test/mxs1776_ps_exec_hang.cpp
Normal file
193
maxscale-system-test/mxs1776_ps_exec_hang.cpp
Normal file
@ -0,0 +1,193 @@
|
||||
#include "testconnections.h"
|
||||
#include <iostream>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct Bind
|
||||
{
|
||||
Bind()
|
||||
{
|
||||
bind.buffer = buffer;
|
||||
bind.buffer_type = MYSQL_TYPE_LONG;
|
||||
bind.error = &err;
|
||||
bind.is_null = &is_null;
|
||||
bind.length = &length;
|
||||
}
|
||||
|
||||
MYSQL_BIND bind;
|
||||
char err = 0;
|
||||
char is_null = 0;
|
||||
char is_unsigned = 0;
|
||||
uint8_t buffer[1024];
|
||||
unsigned long length = 0;
|
||||
};
|
||||
|
||||
struct TestCase
|
||||
{
|
||||
std::string name;
|
||||
std::function<bool (MYSQL*, MYSQL_STMT*, Bind&)> func;
|
||||
};
|
||||
|
||||
bool run_test(TestConnections& test, TestCase test_case)
|
||||
{
|
||||
test.maxscales->connect();
|
||||
|
||||
MYSQL_STMT* stmt = mysql_stmt_init(test.maxscales->conn_rwsplit[0]);
|
||||
std::string query = "SELECT * FROM test.t1";
|
||||
unsigned long cursor_type = CURSOR_TYPE_READ_ONLY;
|
||||
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &cursor_type);
|
||||
|
||||
Bind bind;
|
||||
|
||||
test.set_timeout(30);
|
||||
|
||||
if (mysql_stmt_prepare(stmt, query.c_str(), query.size()))
|
||||
{
|
||||
test.assert(false, "Prepared statement failure: %s", mysql_stmt_error(stmt));
|
||||
}
|
||||
|
||||
cout << test_case.name << endl;
|
||||
test.assert(test_case.func(test.maxscales->conn_rwsplit[0], stmt, bind), "Test '%s' failed",
|
||||
test_case.name.c_str());
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
test.assert(mysql_query(test.maxscales->conn_rwsplit[0], "SELECT 1") == 0, "Normal queries should work");
|
||||
|
||||
test.maxscales->disconnect();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
test.maxscales->connect();
|
||||
|
||||
test.try_query(test.maxscales->conn_rwsplit[0], "CREATE OR REPLACE TABLE test.t1(id INT)");
|
||||
test.try_query(test.maxscales->conn_rwsplit[0], "BEGIN");
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
execute_query(test.maxscales->conn_rwsplit[0], "INSERT INTO test.t1 VALUES (%d)", i);
|
||||
}
|
||||
|
||||
test.try_query(test.maxscales->conn_rwsplit[0], "COMMIT");
|
||||
test.maxscales->disconnect();
|
||||
|
||||
vector<TestCase> tests =
|
||||
{
|
||||
{
|
||||
"Simple execute and fetch",
|
||||
[](MYSQL * conn, MYSQL_STMT * stmt, Bind & bind)
|
||||
{
|
||||
bool rval = true;
|
||||
|
||||
if (mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_bind_result(stmt, &bind.bind))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
|
||||
while (mysql_stmt_fetch(stmt) == 0)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
},
|
||||
{
|
||||
"Multiple overlapping executions without fetch",
|
||||
[](MYSQL * conn, MYSQL_STMT * stmt, Bind & bind)
|
||||
{
|
||||
bool rval = true;
|
||||
|
||||
if (mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
},
|
||||
{
|
||||
"Multiple overlapping executions with fetch",
|
||||
[](MYSQL * conn, MYSQL_STMT * stmt, Bind & bind)
|
||||
{
|
||||
bool rval = true;
|
||||
|
||||
if (mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_bind_result(stmt, &bind.bind))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
|
||||
while (mysql_stmt_fetch(stmt) == 0)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
},
|
||||
{
|
||||
"Execution of queries while fetching",
|
||||
[](MYSQL * conn, MYSQL_STMT * stmt, Bind & bind)
|
||||
{
|
||||
bool rval = true;
|
||||
|
||||
if (mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_bind_result(stmt, &bind.bind))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
|
||||
while (mysql_stmt_fetch(stmt) == 0)
|
||||
{
|
||||
mysql_query(conn, "SELECT 1");
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
},
|
||||
{
|
||||
"Multiple overlapping executions and a query",
|
||||
[](MYSQL * conn, MYSQL_STMT * stmt, Bind & bind)
|
||||
{
|
||||
bool rval = true;
|
||||
|
||||
if (mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_query(conn, "SET @a = 1"))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (auto a : tests)
|
||||
{
|
||||
run_test(test, a);
|
||||
}
|
||||
|
||||
return test.global_result;
|
||||
}
|
||||
24
maxscale-system-test/mxs1786_statistics.cpp
Normal file
24
maxscale-system-test/mxs1786_statistics.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* MXS-1786: Hang with COM_STATISTICS
|
||||
*/
|
||||
|
||||
#include "testconnections.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
test.maxscales->connect();
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
test.set_timeout(10);
|
||||
mysql_stat(test.maxscales->conn_rwsplit[0]);
|
||||
test.try_query(test.maxscales->conn_rwsplit[0], "SELECT 1");
|
||||
}
|
||||
|
||||
test.maxscales->disconnect();
|
||||
|
||||
|
||||
return test.global_result;
|
||||
}
|
||||
62
maxscale-system-test/mxs1787_call_ps.cpp
Normal file
62
maxscale-system-test/mxs1787_call_ps.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
/**
|
||||
* MXS-1787: Crash with PS: CALL p1((SELECT f1()), ?)
|
||||
*/
|
||||
|
||||
#include "testconnections.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct Bind
|
||||
{
|
||||
Bind()
|
||||
{
|
||||
bind.buffer = &data;
|
||||
bind.buffer_type = MYSQL_TYPE_LONG;
|
||||
bind.error = &err;
|
||||
bind.is_null = &is_null;
|
||||
bind.length = &length;
|
||||
}
|
||||
|
||||
MYSQL_BIND bind;
|
||||
char err = 0;
|
||||
char is_null = 0;
|
||||
char is_unsigned = 0;
|
||||
uint32_t data = 1234;
|
||||
unsigned long length = sizeof(data);
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
test.maxscales->connect();
|
||||
|
||||
execute_query(test.maxscales->conn_rwsplit[0], "USE test");
|
||||
execute_query(test.maxscales->conn_rwsplit[0], "CREATE OR REPLACE TABLE t1 AS SELECT 1 AS id");
|
||||
execute_query(test.maxscales->conn_rwsplit[0], "CREATE OR REPLACE FUNCTION f1() RETURNS INT DETERMINISTIC BEGIN RETURN 1; END");
|
||||
execute_query(test.maxscales->conn_rwsplit[0], "CREATE OR REPLACE PROCEDURE p1(IN i INT, IN j INT) BEGIN SELECT i + j; END");
|
||||
|
||||
test.maxscales->disconnect();
|
||||
|
||||
test.maxscales->connect();
|
||||
|
||||
MYSQL_STMT* stmt = mysql_stmt_init(test.maxscales->conn_rwsplit[0]);
|
||||
std::string query = "CALL p1((SELECT f1()), ?)";
|
||||
Bind bind;
|
||||
|
||||
test.set_timeout(30);
|
||||
|
||||
test.assert(mysql_stmt_prepare(stmt, query.c_str(), query.size()) == 0,
|
||||
"Prepared statement failure: %s", mysql_stmt_error(stmt));
|
||||
test.assert(mysql_stmt_bind_param(stmt, &bind.bind) == 0,
|
||||
"Bind failure: %s", mysql_stmt_error(stmt));
|
||||
test.assert(mysql_stmt_execute(stmt) == 0,
|
||||
"Execute failure: %s", mysql_stmt_error(stmt));
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
|
||||
test.assert(mysql_query(test.maxscales->conn_rwsplit[0], "SELECT 1") == 0, "Normal queries should work");
|
||||
test.maxscales->disconnect();
|
||||
|
||||
return test.global_result;
|
||||
}
|
||||
Reference in New Issue
Block a user