diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2019-03-20 18:35:20 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2019-05-03 16:46:11 +0400 |
commit | 779fb636daf4c127dbb90f75bab004ac1bbe12df (patch) | |
tree | 1dadbcd2ec8ce402d0875c04b8b181108d2f8481 /sql/semisync_master.h | |
parent | 894df7edb67b888c41eae5ffbe654ceba97c6b8f (diff) | |
download | mariadb-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/semisync_master.h')
-rw-r--r-- | sql/semisync_master.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/semisync_master.h b/sql/semisync_master.h index de5e3240802..517175b5b06 100644 --- a/sql/semisync_master.h +++ b/sql/semisync_master.h @@ -23,6 +23,7 @@ #include "semisync_master_ack_receiver.h" #ifdef HAVE_PSI_INTERFACE +extern PSI_mutex_key key_LOCK_rpl_semi_sync_master_enabled; extern PSI_mutex_key key_LOCK_binlog; extern PSI_cond_key key_COND_binlog_send; #endif @@ -365,7 +366,6 @@ public: */ class Repl_semi_sync_master :public Repl_semi_sync_base { - private: Active_tranx *m_active_tranxs; /* active transaction list: the list will be cleared when semi-sync switches off. */ @@ -491,8 +491,8 @@ class Repl_semi_sync_master /* Enable the object to enable semi-sync replication inside the master. */ int enable_master(); - /* Enable the object to enable semi-sync replication inside the master. */ - int disable_master(); + /* Disable the object to disable semi-sync replication inside the master. */ + void disable_master(); /* Add a semi-sync replication slave */ void add_slave(); @@ -619,6 +619,8 @@ class Repl_semi_sync_master int before_reset_master(); void check_and_switch(); + + mysql_mutex_t LOCK_rpl_semi_sync_master_enabled; }; enum rpl_semi_sync_master_wait_point_t { |