Skip to content
Permalink
Browse files
A cleanup for MDEV-18333 Slow_queries count doesn't increase when slo…
…w_query_log is turned off

thd->lex->m_sql_cmd was not cleared between queries.
log_slow_query() could crash (when running mtr --ps) because of this.
  • Loading branch information
abarkov committed Mar 6, 2019
1 parent 485dcb0 commit 26f0d72
Showing 1 changed file with 5 additions and 0 deletions.
@@ -1989,6 +1989,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
dec_thread_running();
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
thd->reset_kill_query(); /* Ensure that killed_errmsg is released */
/*
LEX::m_sql_cmd can point to Sql_cmd allocated on thd->mem_root.
Unlink it now, before freeing the root.
*/
thd->lex->m_sql_cmd= NULL;
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));

#if defined(ENABLED_PROFILING)

0 comments on commit 26f0d72

Please sign in to comment.