1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-3945 - do not hold LOCK_thread_count when freeing THD.

The patch decreases the duration of LOCK_thread_count, so it is not hold during THD destructor and freeing memory.
This mutex  now only protects the integrity of threads list, when removing THD from it,  and thread_count variable.
  
The add_to_status() function that updates global status during client disconnect,  is now correctly protected by the LOCK_status mutex.

Benchmark : in a  "non-persistent" sysbench test (oltp_ro with reconnect after each query),  ~ 25% more connects/disconnects were measured
This commit is contained in:
Vladislav Vaintroub
2012-12-21 00:12:37 +01:00
parent 1b2692d0e9
commit 21b4fda3a5
4 changed files with 16 additions and 22 deletions

View File

@@ -1444,7 +1444,6 @@ THD::~THD()
mysql_mutex_lock(&LOCK_thd_data);
mysys_var=0; // Safety (shouldn't be needed)
mysql_mutex_unlock(&LOCK_thd_data);
add_to_status(&global_status_var, &status_var);
/* Close connection */
#ifndef EMBEDDED_LIBRARY