From 9722c0887aa01c2889eee5d01effcc8ec49d7071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 4 Apr 2019 15:33:34 +0300 Subject: [PATCH] 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. --- server/modules/protocol/MySQL/mysql_common.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/modules/protocol/MySQL/mysql_common.cc b/server/modules/protocol/MySQL/mysql_common.cc index c575304f4..648ce60bc 100644 --- a/server/modules/protocol/MySQL/mysql_common.cc +++ b/server/modules/protocol/MySQL/mysql_common.cc @@ -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;