mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Move all kill mutex protection to LOCK_thd_kill
LOCK_thd_data was used to protect both THD data and ensure that the THD is not deleted while it was in use This patch moves the THD delete protection to LOCK_thd_kill, which already protects the THD for kill. The benefits are: - More well defined what LOCK_thd_data protects - LOCK_thd_data usage is now much simpler and easier to verify - Less chance of deadlocks in SHOW PROCESS LIST as there is less chance of interactions between mutexes - Remove not needed LOCK_thread_count from thd_get_error_context_description() - Fewer mutex taken for thd->awake() Other things: - Don't take mysys->var mutex in show processlist to check if thread is kill marked - thd->awake() now automatically takes the LOCK_thd_kill mutex (Simplifies code) - Apc uses LOCK_thd_kill instead of LOCK_thd_data
This commit is contained in:
@ -2127,11 +2127,15 @@ public:
|
||||
- thd->query and thd->query_length (used by SHOW ENGINE
|
||||
INNODB STATUS and SHOW PROCESSLIST
|
||||
- thd->db and thd->db_length (used in SHOW PROCESSLIST)
|
||||
- thd->mysys_var (used by KILL statement and shutdown).
|
||||
Is locked when THD is deleted.
|
||||
*/
|
||||
mysql_mutex_t LOCK_thd_data;
|
||||
/* Protect kill information */
|
||||
/*
|
||||
Protects:
|
||||
- kill information
|
||||
- mysys_var (used by KILL statement and shutdown).
|
||||
- Also ensures that THD is not deleted while mutex is hold
|
||||
*/
|
||||
mysql_mutex_t LOCK_thd_kill;
|
||||
|
||||
/* all prepared statements and cursors of this connection */
|
||||
@ -3131,7 +3135,13 @@ public:
|
||||
}
|
||||
void close_active_vio();
|
||||
#endif
|
||||
void awake(killed_state state_to_set);
|
||||
void awake_no_mutex(killed_state state_to_set);
|
||||
void awake(killed_state state_to_set)
|
||||
{
|
||||
mysql_mutex_lock(&LOCK_thd_kill);
|
||||
awake_no_mutex(state_to_set);
|
||||
mysql_mutex_unlock(&LOCK_thd_kill);
|
||||
}
|
||||
|
||||
/** Disconnect the associated communication endpoint. */
|
||||
void disconnect();
|
||||
|
Reference in New Issue
Block a user