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_mysqld.h | |
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_mysqld.h')
-rw-r--r-- | sql/wsrep_mysqld.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 29b1c4cf1f4..16663f7152c 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -203,7 +203,7 @@ extern void wsrep_close_applier_threads(int count); /* new defines */ extern void wsrep_stop_replication(THD *thd); -extern bool wsrep_start_replication(); +extern bool wsrep_start_replication(const char *wsrep_cluster_address); extern void wsrep_shutdown_replication(); extern bool wsrep_must_sync_wait (THD* thd, uint mask= WSREP_SYNC_WAIT_BEFORE_READ); extern bool wsrep_sync_wait (THD* thd, uint mask= WSREP_SYNC_WAIT_BEFORE_READ); @@ -280,6 +280,13 @@ void WSREP_LOG(void (*fun)(const char* fmt, ...), const char* fmt, ...); #define WSREP_PROVIDER_EXISTS \ (wsrep_provider && strncasecmp(wsrep_provider, WSREP_NONE, FN_REFLEN)) +static inline bool wsrep_cluster_address_exists() +{ + if (mysqld_server_started) + mysql_mutex_assert_owner(&LOCK_global_system_variables); + return wsrep_cluster_address && wsrep_cluster_address[0]; +} + #define WSREP_QUERY(thd) (thd->query()) extern my_bool wsrep_ready_get(); @@ -501,6 +508,7 @@ wsrep::key wsrep_prepare_key_for_toi(const char* db, const char* table, #define wsrep_thr_deinit() do {} while(0) #define wsrep_init_globals() do {} while(0) #define wsrep_create_appliers(X) do {} while(0) +#define wsrep_cluster_address_exists() (false) #endif /* WITH_WSREP */ |