From 2145507c22ca90943e802976c5a1c6bb5fabeb29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Thu, 12 Aug 2021 11:52:53 +0200 Subject: [PATCH] If a session is locked on hostgroup , autocommit is copied from backend connection Closes #3459 --- lib/MySQL_Session.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 9a9f583ea4..0086c3a745 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -4436,6 +4436,14 @@ int MySQL_Session::handler() { handler_rc0_Process_GTID(myconn); + // if we are locked on hostgroup, the value of autocommit is copied from the backend connection + // see bug #3549 + if (locked_on_hostgroup >= 0) { + assert(myconn != NULL); + assert(myconn->mysql != NULL); + autocommit = myconn->mysql->server_status & SERVER_STATUS_AUTOCOMMIT; + } + if (mirror == false) { // Support for LAST_INSERT_ID() if (myconn->mysql->insert_id) {