@@ -218,8 +218,6 @@ net_send_ok(THD *thd,
218
218
NET *net= &thd->net ;
219
219
StringBuffer<MYSQL_ERRMSG_SIZE + 10 > store;
220
220
221
- bool state_changed= false ;
222
-
223
221
bool error= FALSE ;
224
222
DBUG_ENTER (" net_send_ok" );
225
223
@@ -246,6 +244,11 @@ net_send_ok(THD *thd,
246
244
/* last insert id */
247
245
store.q_net_store_length (id);
248
246
247
+ /* if client has not session tracking capability, don't send state change flag*/
248
+ if (!(thd->client_capabilities & CLIENT_SESSION_TRACK)) {
249
+ server_status &= ~SERVER_SESSION_STATE_CHANGED;
250
+ }
251
+
249
252
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
250
253
{
251
254
DBUG_PRINT (" info" ,
@@ -266,21 +269,17 @@ net_send_ok(THD *thd,
266
269
}
267
270
thd->get_stmt_da ()->set_overwrite_status (true );
268
271
269
- state_changed=
270
- (thd->client_capabilities & CLIENT_SESSION_TRACK) &&
271
- (server_status & SERVER_SESSION_STATE_CHANGED);
272
-
273
- if (state_changed || (message && message[0 ]))
272
+ if ((server_status & SERVER_SESSION_STATE_CHANGED) || (message && message[0 ]))
274
273
{
275
274
DBUG_ASSERT (safe_strlen (message) <= MYSQL_ERRMSG_SIZE);
276
275
store.q_net_store_data ((uchar*) safe_str (message), safe_strlen (message));
277
276
}
278
277
279
- if (unlikely (state_changed ))
278
+ if (unlikely (server_status & SERVER_SESSION_STATE_CHANGED ))
280
279
{
281
280
store.set_charset (thd->variables .collation_database );
282
-
283
281
thd->session_tracker .store (thd, &store);
282
+ thd->server_status &= ~SERVER_SESSION_STATE_CHANGED;
284
283
}
285
284
286
285
DBUG_ASSERT (store.length () <= MAX_PACKET_LENGTH);
@@ -289,8 +288,6 @@ net_send_ok(THD *thd,
289
288
if (!error && (!skip_flush || is_eof))
290
289
error= net_flush (net);
291
290
292
- thd->server_status &= ~SERVER_SESSION_STATE_CHANGED;
293
-
294
291
thd->get_stmt_da ()->set_overwrite_status (false );
295
292
DBUG_PRINT (" info" , (" OK sent, so no more error sending allowed" ));
296
293
0 commit comments