diff --git a/include/MySQL_Session.h b/include/MySQL_Session.h index 36086de0f..a657dc85c 100644 --- a/include/MySQL_Session.h +++ b/include/MySQL_Session.h @@ -246,6 +246,7 @@ class MySQL_Session int user_max_connections; int current_hostgroup; int default_hostgroup; + int previous_hostgroup; /** * @brief Charset directly specified by the client. Supplied and updated via 'HandshakeResponse' * and 'COM_CHANGE_USER' packets. diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index beea0ddee..b47bf7201 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -4010,6 +4010,7 @@ __get_pkts_from_client: // The following code prepares the session as if it was configured with fast // forward before receiving the command. This way the state machine will // handle the command automatically. + current_hostgroup = previous_hostgroup; mybe = find_or_create_backend(current_hostgroup); // set a backend mybe->server_myds->reinit_queues(); // reinitialize the queues in the myds . By default, they are not active // We reinitialize the 'wait_until' since this session shouldn't wait for processing as @@ -7440,6 +7441,7 @@ void MySQL_Session::RequestEnd(MySQL_Data_Stream *myds) { CurrentQuery.end(); } started_sending_data_to_client=false; + previous_hostgroup = current_hostgroup; }