Clear most status variables. */
| 9888 | |
| 9889 | /** Clear most status variables. */ |
| 9890 | void refresh_status(THD *thd) |
| 9891 | { |
| 9892 | mysql_mutex_lock(&LOCK_status); |
| 9893 | |
| 9894 | /* Add thread's status variabes to global status */ |
| 9895 | add_to_status(&global_status_var, &thd->status_var); |
| 9896 | |
| 9897 | /* Reset thread's status variables */ |
| 9898 | memset(&thd->status_var, 0, sizeof(thd->status_var)); |
| 9899 | |
| 9900 | /* Reset some global variables */ |
| 9901 | reset_status_vars(); |
| 9902 | |
| 9903 | /* Reset the counters of all key caches (default and named). */ |
| 9904 | process_key_caches(reset_key_cache_counters); |
| 9905 | flush_status_time= time((time_t*) 0); |
| 9906 | mysql_mutex_unlock(&LOCK_status); |
| 9907 | |
| 9908 | /* |
| 9909 | Set max_used_connections to the number of currently open |
| 9910 | connections. Lock LOCK_thread_count out of LOCK_status to avoid |
| 9911 | deadlocks. Status reset becomes not atomic, but status data is |
| 9912 | not exact anyway. |
| 9913 | */ |
| 9914 | mysql_mutex_lock(&LOCK_thread_count); |
| 9915 | max_used_connections= get_thread_count() - delayed_insert_threads; |
| 9916 | mysql_mutex_unlock(&LOCK_thread_count); |
| 9917 | } |
| 9918 | |
| 9919 | |
| 9920 | /***************************************************************************** |
nothing calls this directly
no test coverage detected