diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-23 15:54:09 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-23 15:54:09 +0200 |
commit | e4174b3bbef73655b5c5b94f8dc0f06fb0798eb2 (patch) | |
tree | fc19788ec46e7a7d33554aa7d0d80044474b337c | |
parent | 833d6eed598b7b35f1643afc386493c4b46a9506 (diff) | |
download | mariadb-git-bb-10.5-MDEV-24167.tar.gz |
Use normal mutex for rw_lock_debug_mutexbb-10.5-MDEV-24167
-rw-r--r-- | storage/innobase/include/sync0debug.h | 6 | ||||
-rw-r--r-- | storage/innobase/include/sync0types.h | 1 | ||||
-rw-r--r-- | storage/innobase/sync/sync0debug.cc | 25 |
3 files changed, 7 insertions, 25 deletions
diff --git a/storage/innobase/include/sync0debug.h b/storage/innobase/include/sync0debug.h index 07e985465e0..da3feecfa53 100644 --- a/storage/innobase/include/sync0debug.h +++ b/storage/innobase/include/sync0debug.h @@ -84,11 +84,7 @@ Terminate iteration if the functor returns true. bool sync_check_iterate(const sync_check_functor_t& functor); -/** Acquires the debug mutex. We cannot use the mutex defined in sync0sync, -because the debug mutex is also acquired in sync0arr while holding the OS -mutex protecting the sync array, and the ordinary mutex_enter might -recursively call routines in sync0arr, leading to a deadlock on the OS -mutex. */ +/** Acquires the debug mutex. */ void rw_lock_debug_mutex_enter(); diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h index a40040f31e5..45ca2f4dfe3 100644 --- a/storage/innobase/include/sync0types.h +++ b/storage/innobase/include/sync0types.h @@ -252,7 +252,6 @@ enum latch_id_t { LATCH_ID_RECALC_POOL, LATCH_ID_REDO_RSEG, LATCH_ID_NOREDO_RSEG, - LATCH_ID_RW_LOCK_DEBUG, LATCH_ID_RTR_ACTIVE_MUTEX, LATCH_ID_RTR_MATCH_MUTEX, LATCH_ID_RTR_PATH_MUTEX, diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc index 2748929c1eb..a266e1a283a 100644 --- a/storage/innobase/sync/sync0debug.cc +++ b/storage/innobase/sync/sync0debug.cc @@ -47,7 +47,7 @@ my_bool srv_sync_debug; /** The global mutex which protects debug info lists of all rw-locks. To modify the debug info list of an rw-lock, this mutex has to be acquired in addition to the mutex protecting the lock. */ -static SysMutex rw_lock_debug_mutex; +static mysql_mutex_t rw_lock_debug_mutex; /** The latch held by a thread */ struct Latched { @@ -1105,7 +1105,7 @@ void LatchDebug::init() UNIV_NOTHROW { - mutex_create(LATCH_ID_RW_LOCK_DEBUG, &rw_lock_debug_mutex); + mysql_mutex_init(rw_lock_debug_mutex_key, &rw_lock_debug_mutex, nullptr); } /** Shutdown the latch debug checking @@ -1116,7 +1116,7 @@ void LatchDebug::shutdown() UNIV_NOTHROW { - mutex_free(&rw_lock_debug_mutex); + mysql_mutex_destroy(&rw_lock_debug_mutex); ut_a(s_initialized); @@ -1127,22 +1127,18 @@ LatchDebug::shutdown() LatchDebug::s_instance = NULL; } -/** Acquires the debug mutex. We cannot use the mutex defined in sync0sync, -because the debug mutex is also acquired in sync0arr while holding the OS -mutex protecting the sync array, and the ordinary mutex_enter might -recursively call routines in sync0arr, leading to a deadlock on the OS -mutex. */ +/** Acquires the debug mutex. */ void rw_lock_debug_mutex_enter() { - mutex_enter(&rw_lock_debug_mutex); + mysql_mutex_lock(&rw_lock_debug_mutex); } /** Releases the debug mutex. */ void rw_lock_debug_mutex_exit() { - mutex_exit(&rw_lock_debug_mutex); + mysql_mutex_unlock(&rw_lock_debug_mutex); } #endif /* UNIV_DEBUG */ @@ -1186,15 +1182,6 @@ sync_latch_meta_init() LATCH_ADD_MUTEX(NOREDO_RSEG, SYNC_NOREDO_RSEG, noredo_rseg_mutex_key); -#ifdef UNIV_DEBUG - /* Mutex names starting with '.' are not tracked. They are assumed - to be diagnostic mutexes used in debugging. */ - latch_meta[LATCH_ID_RW_LOCK_DEBUG] = - LATCH_ADD_MUTEX(RW_LOCK_DEBUG, - SYNC_NO_ORDER_CHECK, - rw_lock_debug_mutex_key); -#endif /* UNIV_DEBUG */ - LATCH_ADD_MUTEX(RTR_ACTIVE_MUTEX, SYNC_ANY_LATCH, rtr_active_mutex_key); |