mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-14505 - Threads_running becomes scalability bottleneck
Instead of updating global counter, calculate Threads_running on the fly. All threads having command != COM_SLEEP are included. Behaviour changes: Previously SHOW STATUS and SHOW GLOBAL STATUS returned the same values representing global status. Now SHOW STATUS always returns 1 indicating that current session has 1 thread running. Previously only threads that were executing dispatch_command() or running events were accounted by Threads_running. Now it is rough equivalent of SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE state!='Sleep'
This commit is contained in:
@ -1550,9 +1550,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
"<?>")));
|
||||
bool drop_more_results= 0;
|
||||
|
||||
if (!is_com_multi)
|
||||
inc_thread_running();
|
||||
|
||||
/* keep it withing 1 byte */
|
||||
compile_time_assert(COM_END == 255);
|
||||
|
||||
@ -2410,10 +2407,8 @@ com_multi_end:
|
||||
thd->m_digest= NULL;
|
||||
|
||||
if (!is_com_multi)
|
||||
{
|
||||
dec_thread_running();
|
||||
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
|
||||
}
|
||||
|
||||
thd->reset_kill_query(); /* Ensure that killed_errmsg is released */
|
||||
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
||||
|
||||
|
Reference in New Issue
Block a user