diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-02-12 17:31:25 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-02-14 23:18:42 +0100 |
commit | 26965387230a9b13fb716344477d108bb87dea98 (patch) | |
tree | ad6c110d3d82f073554489610265b56f758efb73 /sql/wsrep_thd.cc | |
parent | b91e77cff3fb5fbb32ebb061ed342469b434c4e8 (diff) | |
download | mariadb-git-26965387230a9b13fb716344477d108bb87dea98.tar.gz |
updating @@wsrep_cluster_address deadlocks
wsrep_cluster_address_update() causes LOCK_wsrep_slave_threads
to be locked under LOCK_wsrep_cluster_config, while normally
the order should be the opposite.
Fix: don't protect @@wsrep_cluster_address value with the
LOCK_wsrep_cluster_config, LOCK_global_system_variables is enough.
Only protect wsrep reinitialization with the LOCK_wsrep_cluster_config.
And make it use a local copy of the global @@wsrep_cluster_address.
Also, introduce a helper function that checks whether
wsrep_cluster_address is set and also asserts that it can be safely
read by the caller.
Diffstat (limited to 'sql/wsrep_thd.cc')
-rw-r--r-- | sql/wsrep_thd.cc | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 26cfa4c58c4..2d814c62424 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -125,11 +125,7 @@ bool wsrep_create_appliers(long threads, bool mutex_protected) return false; } - if (!wsrep_cluster_address || wsrep_cluster_address[0]== 0) - { - WSREP_DEBUG("wsrep_create_appliers exit due to empty address"); - return false; - } + DBUG_ASSERT(wsrep_cluster_address[0]); long wsrep_threads=0; @@ -284,16 +280,14 @@ static void wsrep_rollback_process(THD *rollbacker, void wsrep_create_rollbacker() { - if (wsrep_cluster_address && wsrep_cluster_address[0] != 0) - { - Wsrep_thd_args* args(new Wsrep_thd_args(wsrep_rollback_process, - WSREP_ROLLBACKER_THREAD, - pthread_self())); - - /* create rollbacker */ - if (create_wsrep_THD(args, false)) - WSREP_WARN("Can't create thread to manage wsrep rollback"); - } + DBUG_ASSERT(wsrep_cluster_address[0]); + Wsrep_thd_args* args(new Wsrep_thd_args(wsrep_rollback_process, + WSREP_ROLLBACKER_THREAD, + pthread_self())); + + /* create rollbacker */ + if (create_wsrep_THD(args, false)) + WSREP_WARN("Can't create thread to manage wsrep rollback"); } /* |