From 45e9401bc224a3d73a25bb5a7f4ba5ba2fc5234e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Thu, 24 May 2018 17:27:41 +0200 Subject: [PATCH] Optimize SQL3_Processlist() Lock one thread at the time instead of locking all of them at once Also removed unnecessary signal_all_threads() --- lib/MySQL_Thread.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index f07ba92d2..966e598d0 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -3984,7 +3984,7 @@ SQLite3_result * MySQL_Threads_Handler::SQL3_Processlist() { result->add_column_definition(SQLITE_TEXT,"info"); unsigned int i; unsigned int i2; - signal_all_threads(1); +// signal_all_threads(1); MySQL_Thread *thr=NULL; i2=num_threads; #ifdef IDLE_THREADS @@ -4005,6 +4005,7 @@ SQLite3_result * MySQL_Threads_Handler::SQL3_Processlist() { } #endif // IDLE_THREADS } +/* } #ifdef IDLE_THREADS for (i=0;i < ( (mysql_thread___session_idle_show_processlist && GloVars.global.idle_threads ) ? num_threads*2 : num_threads); i++) { @@ -4018,6 +4019,7 @@ SQLite3_result * MySQL_Threads_Handler::SQL3_Processlist() { thr=(MySQL_Thread *)mysql_threads_idles[i-num_threads].worker; #endif // IDLE_THREADS } +*/ unsigned int j; for (j=0; jmysql_sessions->len; j++) { MySQL_Session *sess=(MySQL_Session *)thr->mysql_sessions->pdata[j]; @@ -4231,12 +4233,14 @@ SQLite3_result * MySQL_Threads_Handler::SQL3_Processlist() { free(pta); } } +/* } #ifdef IDLE_THREADS for (i=0;i < ( (mysql_thread___session_idle_show_processlist && GloVars.global.idle_threads ) ? num_threads*2 : num_threads); i++) { #else for (i=0;i < num_threads; i++) { #endif // IDLE_THREADS +*/ if (ithread_mutex);