From c9b0c5a15c76b6611000d77d64efb7bca41b5f8d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Dec 2008 22:09:59 +0200 Subject: Fixed mutexes lock order in maria_close(): LOCK_trn_list -> MARIA_SHARE::intern_lock (then will be WL to revert the order). (BUG#40981 Maria: deadlock between checkpoint and maria_close() when freeing state info) storage/maria/ma_checkpoint.c: The argument added to the function to use it in maria_close(). storage/maria/ma_close.c: Locking/unlocking MARIA_SHARE::intern_lock added to use correct order of the mutexes taking. storage/maria/ma_state.c: Removed assert becase now we have externally locked mutex in maria_close(). The argument added to the _ma_remove_not_visible_states_with_lock() to use it in maria_close(). _ma_remove_not_visible_states_with_lock() fixed tio be usable from maria_chk where transaction manager is not initialized. storage/maria/ma_state.h: The argument added to the function to use it in maria_close(). storage/maria/maria_def.h: Fixed comment to the variable. storage/maria/trnman.c: The debugging assert added. New function to detect transaction manager initialization added (maria_chk do not initialize it). storage/maria/trnman_public.h: New function to detect transaction manager initialization added (maria_chk do not initialize it). --- storage/maria/trnman.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'storage/maria/trnman.c') diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c index 538dc75b663..f7afea51a63 100644 --- a/storage/maria/trnman.c +++ b/storage/maria/trnman.c @@ -874,6 +874,7 @@ my_bool trnman_exists_active_transactions(TrID min_id, TrID max_id, if (!trnman_is_locked) pthread_mutex_lock(&LOCK_trn_list); + safe_mutex_assert_owner(&LOCK_trn_list); for (trn= active_list_min.next; trn != &active_list_max; trn= trn->next) { if (trn->trid > min_id && trn->trid < max_id) @@ -897,6 +898,7 @@ void trnman_lock() pthread_mutex_lock(&LOCK_trn_list); } + /** unlock transaction list */ @@ -905,3 +907,13 @@ void trnman_unlock() { pthread_mutex_unlock(&LOCK_trn_list); } + + +/** + Is trman initialized +*/ + +my_bool trman_is_inited() +{ + return (short_trid_to_active_trn != NULL); +} -- cgit v1.2.1