summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-10-28 09:08:58 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-10-28 09:08:58 +0300
commitd8c6c53a0658ea8315252997f65d796b13182387 (patch)
tree26cb3a48c75fb94307ee564185b45fd7d94f80f7 /sql/protocol.cc
parent1ad1d789815ddada89d8fb557a47a437d1ea21c2 (diff)
parenta8ded395578ccab9c256b9beee7e62d4ada08522 (diff)
downloadmariadb-git-d8c6c53a0658ea8315252997f65d796b13182387.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc19
1 files changed, 8 insertions, 11 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 7886ecd3043..b2ca946037c 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -216,8 +216,6 @@ Protocol::net_send_ok(THD *thd,
NET *net= &thd->net;
StringBuffer<MYSQL_ERRMSG_SIZE + 10> store;
- bool state_changed= false;
-
bool error= FALSE;
DBUG_ENTER("Protocol::net_send_ok");
@@ -244,6 +242,11 @@ Protocol::net_send_ok(THD *thd,
/* last insert id */
store.q_net_store_length(id);
+ /* if client has not session tracking capability, don't send state change flag*/
+ if (!(thd->client_capabilities & CLIENT_SESSION_TRACK)) {
+ server_status &= ~SERVER_SESSION_STATE_CHANGED;
+ }
+
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
{
DBUG_PRINT("info",
@@ -264,21 +267,17 @@ Protocol::net_send_ok(THD *thd,
}
thd->get_stmt_da()->set_overwrite_status(true);
- state_changed=
- (thd->client_capabilities & CLIENT_SESSION_TRACK) &&
- (server_status & SERVER_SESSION_STATE_CHANGED);
-
- if (state_changed || (message && message[0]))
+ if ((server_status & SERVER_SESSION_STATE_CHANGED) || (message && message[0]))
{
DBUG_ASSERT(safe_strlen(message) <= MYSQL_ERRMSG_SIZE);
store.q_net_store_data((uchar*) safe_str(message), safe_strlen(message));
}
- if (unlikely(state_changed))
+ if (unlikely(server_status & SERVER_SESSION_STATE_CHANGED))
{
store.set_charset(thd->variables.collation_database);
-
thd->session_tracker.store(thd, &store);
+ thd->server_status&= ~SERVER_SESSION_STATE_CHANGED;
}
DBUG_ASSERT(store.length() <= MAX_PACKET_LENGTH);
@@ -287,8 +286,6 @@ Protocol::net_send_ok(THD *thd,
if (likely(!error))
error= net_flush(net);
- thd->server_status&= ~SERVER_SESSION_STATE_CHANGED;
-
thd->get_stmt_da()->set_overwrite_status(false);
DBUG_PRINT("info", ("OK sent, so no more error sending allowed"));