A cleanup for MDEV-18333 Slow_queries count doesn't increase when slow_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.
This commit is contained in:
parent
485dcb07d1
commit
26f0d72a3f
@ -1989,6 +1989,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
dec_thread_running();
|
dec_thread_running();
|
||||||
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
|
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
|
||||||
thd->reset_kill_query(); /* Ensure that killed_errmsg is released */
|
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));
|
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
||||||
|
|
||||||
#if defined(ENABLED_PROFILING)
|
#if defined(ENABLED_PROFILING)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user