MXS-2464: Add test case

The bug appears when a session command that is executed on the master
fails. The logic in the code doesn't take this case into consideration
when it processes failed connections.
This commit is contained in:
Markus Mäkelä
2019-05-31 07:53:02 +03:00
parent 9481992bb9
commit 13b258a151
3 changed files with 67 additions and 0 deletions

View File

@ -951,6 +951,9 @@ add_test_executable(pam_authentication.cpp pam_authentication pam_authentication
# MXS-2520: Allow master reconnection on reads # MXS-2520: Allow master reconnection on reads
add_test_executable(mxs2520_master_read_reconnect.cpp mxs2520_master_read_reconnect mxs2520_master_read_reconnect LABELS REPL_BACKEND readwritesplit) add_test_executable(mxs2520_master_read_reconnect.cpp mxs2520_master_read_reconnect mxs2520_master_read_reconnect LABELS REPL_BACKEND readwritesplit)
# MXS-2464: Crash in route_stored_query with ReadWriteSplit
add_test_executable(mxs2464_sescmd_reconnect.cpp mxs2464_sescmd_reconnect mxs2464_sescmd_reconnect LABELS REPL_BACKEND readwritesplit)
############################################ ############################################
# BEGIN: binlogrouter and avrorouter tests # # BEGIN: binlogrouter and avrorouter tests #
############################################ ############################################

View File

@ -0,0 +1,29 @@
[maxscale]
threads=###threads###
[MySQL-Monitor]
type=monitor
module=mysqlmon
servers=###server_line###
user=maxskysql
password=skysql
monitor_interval=1000
backend_read_timeout=1
backend_connect_timeout=1
[RW-Split-Router]
type=service
router=readwritesplit
servers=###server_line###
user=maxskysql
password=skysql
delayed_retry_timeout=1
transaction_replay=true
[RW-Split-Listener]
type=listener
service=RW-Split-Router
protocol=MySQLClient
port=4006
###server###

View File

@ -0,0 +1,35 @@
/**
* MXS-2464: Crash in route_stored_query with ReadWriteSplit
* https://jira.mariadb.org/browse/MXS-2464
*/
#include "testconnections.h"
int main(int argc, char* argv[])
{
TestConnections test(argc, argv);
test.maxscales->connect();
std::thread thr([&]() {
sleep(5);
test.tprintf("block node 0");
test.repl->block_node(0);
test.tprintf("wait for monitor");
test.maxscales->wait_for_monitor(2);
test.tprintf("unblock node 0");
test.repl->unblock_node(0);
});
constexpr const char* query = "SET @a = (SELECT SLEEP(10))";
test.set_timeout(60);
test.tprintf("%s", query);
test.try_query(test.maxscales->conn_rwsplit[0], query);
test.stop_timeout();
test.tprintf("disconnect");
test.maxscales->disconnect();
test.tprintf("join");
thr.join();
return test.global_result;
}