MXS-2450: Don't discard history if it's disabled
If the session command history is not enabled, it shouldn't be discarded when a COM_CHANGE_USER is executed.
This commit is contained in:
@ -942,6 +942,9 @@ add_test_executable(mxs2326_hint_clone.cpp mxs2326_hint_clone mxs2326_hint_clone
|
|||||||
# MXS-2417: Ignore persisted configs with load_persisted_configs=false
|
# MXS-2417: Ignore persisted configs with load_persisted_configs=false
|
||||||
add_test_executable(mxs2417_ignore_persisted_cnf.cpp mxs2417_ignore_persisted_cnf mxs2417_ignore_persisted_cnf LABELS REPL_BACKEND)
|
add_test_executable(mxs2417_ignore_persisted_cnf.cpp mxs2417_ignore_persisted_cnf mxs2417_ignore_persisted_cnf LABELS REPL_BACKEND)
|
||||||
|
|
||||||
|
# MXS-2450: Crash on COM_CHANGE_USER with disable_sescmd_history=true
|
||||||
|
add_test_executable(mxs2450_change_user_crash.cpp mxs2450_change_user_crash mxs2450_change_user_crash LABELS REPL_BACKEND)
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# BEGIN: binlogrouter and avrorouter tests #
|
# BEGIN: binlogrouter and avrorouter tests #
|
||||||
############################################
|
############################################
|
||||||
|
49
maxscale-system-test/cnf/maxscale.cnf.template.mxs2450_change_user_crash
Executable file
49
maxscale-system-test/cnf/maxscale.cnf.template.mxs2450_change_user_crash
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
[maxscale]
|
||||||
|
threads=###threads###
|
||||||
|
log_info=1
|
||||||
|
|
||||||
|
[server1]
|
||||||
|
type=server
|
||||||
|
address=###node_server_IP_1###
|
||||||
|
port=###node_server_port_1###
|
||||||
|
protocol=MySQLBackend
|
||||||
|
|
||||||
|
[server2]
|
||||||
|
type=server
|
||||||
|
address=###node_server_IP_2###
|
||||||
|
port=###node_server_port_2###
|
||||||
|
protocol=MySQLBackend
|
||||||
|
|
||||||
|
[server3]
|
||||||
|
type=server
|
||||||
|
address=###node_server_IP_3###
|
||||||
|
port=###node_server_port_3###
|
||||||
|
protocol=MySQLBackend
|
||||||
|
|
||||||
|
[server4]
|
||||||
|
type=server
|
||||||
|
address=###node_server_IP_4###
|
||||||
|
port=###node_server_port_4###
|
||||||
|
protocol=MySQLBackend
|
||||||
|
|
||||||
|
[MySQL Monitor]
|
||||||
|
type=monitor
|
||||||
|
module=mysqlmon
|
||||||
|
servers=server1,server2,server3,server4
|
||||||
|
user=maxskysql
|
||||||
|
password=skysql
|
||||||
|
monitor_interval=1000
|
||||||
|
|
||||||
|
[RW Split Router]
|
||||||
|
type=service
|
||||||
|
router=readwritesplit
|
||||||
|
servers=server1,server2,server3,server4
|
||||||
|
user=maxskysql
|
||||||
|
password=skysql
|
||||||
|
disable_sescmd_history=true
|
||||||
|
|
||||||
|
[RW Split Listener]
|
||||||
|
type=listener
|
||||||
|
service=RW Split Router
|
||||||
|
protocol=MySQLClient
|
||||||
|
port=4006
|
20
maxscale-system-test/mxs2450_change_user_crash.cpp
Normal file
20
maxscale-system-test/mxs2450_change_user_crash.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* MXS-2450: Crash on COM_CHANGE_USER with disable_sescmd_history=true
|
||||||
|
* https://jira.mariadb.org/browse/MXS-2450
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "testconnections.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
TestConnections test(argc, argv);
|
||||||
|
Connection conn = test.maxscales->rwsplit();
|
||||||
|
test.expect(conn.connect(), "Connection failed: %s", conn.error());
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
test.expect(conn.reset_connection(), "Connection reset failed: %s", conn.error());
|
||||||
|
}
|
||||||
|
|
||||||
|
return test.global_result;
|
||||||
|
}
|
@ -162,9 +162,10 @@ void RWSplitSession::process_sescmd_response(SRWBackend& backend, GWBUF** ppPack
|
|||||||
*ppPacket = NULL;
|
*ppPacket = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_expected_responses == 0
|
if (m_expected_responses == 0 && !m_config.disable_sescmd_history
|
||||||
&& (command == MXS_COM_CHANGE_USER || command == MXS_COM_RESET_CONNECTION))
|
&& (command == MXS_COM_CHANGE_USER || command == MXS_COM_RESET_CONNECTION))
|
||||||
{
|
{
|
||||||
|
mxb_assert_message(!m_sescmd_list.empty(), "Must have stored session commands");
|
||||||
mxb_assert_message(m_slave_responses.empty(), "All responses should've been processed");
|
mxb_assert_message(m_slave_responses.empty(), "All responses should've been processed");
|
||||||
// This is the last session command to finish that resets the session state, reset the history
|
// This is the last session command to finish that resets the session state, reset the history
|
||||||
MXS_INFO("Resetting session command history (length: %lu)", m_sescmd_list.size());
|
MXS_INFO("Resetting session command history (length: %lu)", m_sescmd_list.size());
|
||||||
|
Reference in New Issue
Block a user