MXS-1852: Close partially connected DCBs if killed
If a connection is killed but the backend DCBs have not yet received their thread IDs, the connections can be forcibly closed. This removes the possibility of stale connections caused by an unfortunately timed KILL query to a session that has partially connected to some servers.
This commit is contained in:
parent
39789c19d3
commit
dbbd0e957a
@ -29,6 +29,7 @@
|
||||
#include <maxscale/protocol/mysql.h>
|
||||
#include <maxscale/utils.h>
|
||||
#include <maxscale/protocol/mariadb_client.hh>
|
||||
#include <maxscale/poll.h>
|
||||
|
||||
|
||||
uint8_t null_client_sha1[MYSQL_SCRAMBLE_LEN] = "";
|
||||
@ -1694,7 +1695,17 @@ static bool kill_func(DCB *dcb, void *data)
|
||||
dcb->session->ses_id == info->target_id)
|
||||
{
|
||||
MySQLProtocol* proto = (MySQLProtocol*)dcb->protocol;
|
||||
info->targets.push_back(std::make_pair(dcb->server, proto->thread_id));
|
||||
|
||||
if (proto->thread_id)
|
||||
{
|
||||
// DCB is connected and we know the thread ID so we can kill it
|
||||
info->targets.push_back(std::make_pair(dcb->server, proto->thread_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
// DCB is not yet connected, send a hangup to forcibly close it
|
||||
poll_fake_hangup_event(dcb);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user