diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-02-07 17:48:58 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-02-12 18:17:06 +0100 |
commit | eac8341df4c3c7b98360f4e9498acf393dc055e3 (patch) | |
tree | 6e68141971047c34568b42451f1510ba906d4497 /sql/wsrep_server_service.cc | |
parent | 9703cffa8cb57e2fe29719f4aae3282bfae82878 (diff) | |
download | mariadb-git-eac8341df4c3c7b98360f4e9498acf393dc055e3.tar.gz |
MDEV-23328 Server hang due to Galera lock conflict resolution
adaptation of 29bbcac0ee8 for 10.4
Diffstat (limited to 'sql/wsrep_server_service.cc')
-rw-r--r-- | sql/wsrep_server_service.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index cd432ab3eae..19259a43925 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -40,6 +40,7 @@ static void init_service_thd(THD* thd, char* thread_stack) thd->prior_thr_create_utime= thd->start_utime= microsecond_interval_timer(); thd->set_command(COM_SLEEP); thd->reset_for_next_command(true); + server_threads.insert(thd); // as wsrep_innobase_kill_one_trx() uses find_thread_by_id() } Wsrep_storage_service* @@ -79,6 +80,7 @@ void Wsrep_server_service::release_storage_service( static_cast<Wsrep_storage_service*>(storage_service); THD* thd= ss->m_thd; wsrep_reset_threadvars(thd); + server_threads.erase(thd); delete ss; delete thd; } @@ -92,7 +94,8 @@ wsrep_create_streaming_applier(THD *orig_thd, const char *ctx) streaming transaction is BF aborted and streaming applier is created from BF aborter context. */ Wsrep_threadvars saved_threadvars(wsrep_save_threadvars()); - wsrep_reset_threadvars(saved_threadvars.cur_thd); + if (saved_threadvars.cur_thd) + wsrep_reset_threadvars(saved_threadvars.cur_thd); THD *thd= 0; Wsrep_applier_service *ret= 0; if (!wsrep_create_threadvars() && @@ -109,7 +112,8 @@ wsrep_create_streaming_applier(THD *orig_thd, const char *ctx) } /* Restore original thread local storage state before returning. */ wsrep_restore_threadvars(saved_threadvars); - wsrep_store_threadvars(saved_threadvars.cur_thd); + if (saved_threadvars.cur_thd) + wsrep_store_threadvars(saved_threadvars.cur_thd); return ret; } @@ -138,6 +142,7 @@ void Wsrep_server_service::release_high_priority_service(wsrep::high_priority_se THD* thd= hps->m_thd; delete hps; wsrep_store_threadvars(thd); + server_threads.erase(thd); delete thd; wsrep_delete_threadvars(); } |