summaryrefslogtreecommitdiff
path: root/sql/session_tracker.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2019-03-20 18:35:20 +0400
committerSergey Vojtovich <svoj@mariadb.org>2019-05-03 16:46:11 +0400
commit779fb636daf4c127dbb90f75bab004ac1bbe12df (patch)
tree1dadbcd2ec8ce402d0875c04b8b181108d2f8481 /sql/session_tracker.cc
parent894df7edb67b888c41eae5ffbe654ceba97c6b8f (diff)
downloadmariadb-git-779fb636daf4c127dbb90f75bab004ac1bbe12df.tar.gz
Revert THD::THD(skip_global_sys_var_lock) argumentbb-10.3-svoj-MDEV-14984
Originally introduced by e972125f1 to avoid harmless wait for LOCK_global_system_variables in a newly created thread, which creation was initiated by system variable update. At the same time it opens dangerous hole, when system variable update thread already released LOCK_global_system_variables and ack_receiver thread haven't yet completed new THD construction. In this case THD constructor goes completely unprotected. Since ack_receiver.stop() waits for the thread to go down, we have to temporarily release LOCK_global_system_variables so that it doesn't deadlock with ack_receiver.run(). Unfortunately it breaks atomicity of rpl_semi_sync_master_enabled updates and makes them not serialized. LOCK_rpl_semi_sync_master_enabled was introduced to workaround the above. TODO: move ack_receiver start/stop into repl_semisync_master enable_master/disable_master under LOCK_binlog protection? Part of MDEV-14984 - regression in connect performance
Diffstat (limited to 'sql/session_tracker.cc')
-rw-r--r--sql/session_tracker.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc
index 63a6770f7d1..f4dab11bb42 100644
--- a/sql/session_tracker.cc
+++ b/sql/session_tracker.cc
@@ -322,6 +322,7 @@ bool Session_sysvars_tracker::vars_list::construct_var_list(char *buf,
void Session_sysvars_tracker::init(THD *thd)
{
+ mysql_mutex_assert_owner(&LOCK_global_system_variables);
DBUG_ASSERT(thd->variables.session_track_system_variables ==
global_system_variables.session_track_system_variables);
DBUG_ASSERT(global_system_variables.session_track_system_variables);