From e105f06ea37cd48f2b6e3b29f3d91c74ee3e57f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 20 Aug 2020 12:52:58 +0300 Subject: [PATCH] Log latest session command on unexpected result --- server/modules/routing/readwritesplit/rwsplitsession.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/modules/routing/readwritesplit/rwsplitsession.cc b/server/modules/routing/readwritesplit/rwsplitsession.cc index 925adf6af..81c72bde1 100644 --- a/server/modules/routing/readwritesplit/rwsplitsession.cc +++ b/server/modules/routing/readwritesplit/rwsplitsession.cc @@ -597,6 +597,15 @@ void RWSplitSession::clientReply(GWBUF* writebuf, DCB* backend_dcb) * logic cannot handle this situation. Routing the reply straight to * the client should be the safest thing to do at this point. */ log_unexpected_response(backend, writebuf, m_current_query.get()); + + if (!m_sescmd_list.empty()) + { + auto cmd = m_sescmd_list.back()->get_command(); + auto query = m_sescmd_list.back()->to_string(); + MXS_ERROR("Latest session command: (%s) %s", + STRPACKETTYPE(cmd), query.empty() ? "" : query.c_str()); + } + MXS_SESSION_ROUTE_REPLY(backend_dcb->session, writebuf); } return;