Assign hostgroup from previous COM_QUERY

The destination hostgroup assigned from previous COM_QUERY commands is
the one used to establish the fast_forward connection. As a result,
multiple binlog clients can consume binlog events from different MySQL
hostgroups using the same username.
pull/4105/head
Javier Sánchez Parra 3 years ago
parent d220a42599
commit 1e00e1f021

@ -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.

@ -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;
}

Loading…
Cancel
Save