From e45759d35d9359f0cf38ca20834796bf1e274d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 16 Mar 2018 07:58:29 +0200 Subject: [PATCH] Skip scanning of OK packets if preparing statement The OK packet that a COM_STMT_PREPARE returns is not a normal OK packet and need to be skipped as the packet layout is different. --- .../modules/protocol/MySQL/mariadbbackend/mysql_backend.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c index e67672a69..5a060e0e1 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c @@ -766,9 +766,13 @@ gw_read_and_write(DCB *dcb) return 0; } - if (rcap_type_required(capabilities, RCAP_TYPE_SESSION_STATE_TRACKING)) + /** Get sesion track info from ok packet and save it to gwbuf properties. + * + * The OK packets sent in response to COM_STMT_PREPARE are of a different + * format so we need to detect and skip them. */ + if (rcap_type_required(capabilities, RCAP_TYPE_SESSION_STATE_TRACKING) && + !expecting_ps_response(proto)) { - /** Get session track info from ok packet and save it to gwbuf properties */ mxs_mysql_get_session_track_info(tmp, proto); }