From aaec73a8c869f60f408d1b8d34cdd8e6966f4ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 23 Jul 2020 09:17:01 +0300 Subject: [PATCH] MXS-3089: Close backend on failed session command This correctly triggers the session command response processing to accept results from other servers than the current master backend if the session can continue. If the session cannot continue, it will be stopped immediately. --- .../routing/readwritesplit/rwsplit_route_stmt.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 30d88f0c4..7fcf40c38 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -530,9 +530,19 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3 } else { - MXS_ERROR("Failed to execute session command in %s (%s)", - backend->name(), - backend->uri()); + backend->close(); + + if (m_config.master_failure_mode == RW_FAIL_INSTANTLY && backend == m_current_master) + { + MXS_ERROR("Failed to execute session command in Master: %s (%s)", + backend->name(), backend->uri()); + return false; + } + else + { + MXS_ERROR("Failed to execute session command in %s (%s)", + backend->name(), backend->uri()); + } } } }