Log connection ID when reading server handshake

By logging the connection ID for each created connection, failures can be
traced back from the backend server all the way up to the client
application.
This commit is contained in:
Markus Mäkelä 2019-04-04 15:33:34 +03:00
parent ec890b33cd
commit 9722c0887a
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -1080,6 +1080,14 @@ int gw_decode_mysql_server_handshake(MySQLProtocol* conn, uint8_t* payload)
// get ThreadID: 4 bytes
uint32_t tid = gw_mysql_get_byte4(payload);
// LocalClient also uses this code and it doesn't populate the server pointer
// TODO: fix it
if (conn->owner_dcb && conn->owner_dcb->server)
{
MXS_INFO("Connected to '%s' with thread id %u", conn->owner_dcb->server->name, tid);
}
/* TODO: Correct value of thread id could be queried later from backend if
* there is any worry it might be larger than 32bit allows. */
conn->thread_id = tid;