From 9703cffa8cb57e2fe29719f4aae3282bfae82878 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 5 Feb 2021 14:59:27 +0100 Subject: don't take mutexes conditionally --- sql/log_event.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'sql/log_event.cc') diff --git a/sql/log_event.cc b/sql/log_event.cc index 52995cc7e66..89ffebf2659 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -9049,16 +9049,14 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi) res= trans_commit(thd); /* Automatically rolls back on error. */ thd->release_transactional_locks(); + mysql_mutex_lock(&thd->LOCK_thd_data); #ifdef WITH_WSREP - if (WSREP(thd)) mysql_mutex_lock(&thd->LOCK_thd_data); - if ((!res || (WSREP(thd) && thd->wsrep_trx().state() == wsrep::transaction::s_must_replay )) && sub_id) + if (sub_id && (!res || (WSREP(thd) && thd->wsrep_trx().state() == wsrep::transaction::s_must_replay))) #else - if (likely(!res) && sub_id) + if (sub_id && !res) #endif /* WITH_WSREP */ rpl_global_gtid_slave_state->update_state_hash(sub_id, >id, hton, rgi); -#ifdef WITH_WSREP - if (WSREP(thd)) mysql_mutex_unlock(&thd->LOCK_thd_data); -#endif /* WITH_WSREP */ + mysql_mutex_unlock(&thd->LOCK_thd_data); /* Increment the global status commit count variable */ -- cgit v1.2.1