diff options
Diffstat (limited to 'sql/sql_connect.cc')
-rw-r--r-- | sql/sql_connect.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 1b6c337a43e..8f02828e18c 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1077,8 +1077,8 @@ void prepare_new_connection_state(THD* thd) pthread_handler_t handle_one_connection(void *arg) { THD *thd= (THD*) arg; - ulong launch_time= (ulong) ((thd->thr_create_utime= my_micro_time()) - - thd->connect_utime); + + thd->thr_create_utime= my_micro_time(); if (thread_scheduler.init_new_connection_thread()) { @@ -1087,8 +1087,20 @@ pthread_handler_t handle_one_connection(void *arg) thd->scheduler->end_thread(thd,0); return 0; } - if (launch_time >= slow_launch_time*1000000L) - statistic_increment(slow_launch_threads,&LOCK_status); + + /* + If a thread was created to handle this connection: + increment slow_launch_threads counter if it took more than + slow_launch_time seconds to create the thread. + */ + if (thd->prior_thr_create_utime) + { + ulong launch_time= (ulong) (thd->thr_create_utime - + thd->prior_thr_create_utime); + if (launch_time >= slow_launch_time*1000000L) + statistic_increment(slow_launch_threads, &LOCK_status); + thd->prior_thr_create_utime= 0; + } /* handle_one_connection() is normally the only way a thread would |