Hi, Seppo, Jan! Looks pretty much ok too. A few comments, see below On Oct 29, sjaakola wrote:
revision-id: 778d88ea2d9 (mariadb-10.4.21-76-g778d88ea2d9) parent(s): e2e4e06f081 author: sjaakola committer: Jan Lindström timestamp: 2021-10-28 11:06:22 +0300 message:
MDEV-23328 Server hang due to Galera lock conflict resolution
diff --git a/sql/log_event.cc b/sql/log_event.cc index c1c753d69fd..a1562016aa4 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -8987,6 +8987,18 @@ bool Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) +static bool wsrep_must_replay(THD *thd) +{ +#ifdef WITH_WSREP + mysql_mutex_lock(&thd->LOCK_thd_data); + bool res= WSREP(thd) && thd->wsrep_trx().state() == wsrep::transaction::s_must_replay;
check WSREP(thd) outside of the mutex
+ mysql_mutex_unlock(&thd->LOCK_thd_data); + return res; +#else + return false; +#endif +} + int Xid_log_event::do_apply_event(rpl_group_info *rgi) { bool res; diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index 6566bb372d8..18067a4d0ec 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -29,12 +29,14 @@ extern "C" my_bool wsrep_on(const THD *thd)
extern "C" void wsrep_thd_LOCK(const THD *thd) { + mysql_mutex_lock(&thd->LOCK_thd_kill); mysql_mutex_lock(&thd->LOCK_thd_data);
I presume, you can remove wsrep_thd_kill_LOCK() and wsrep_thd_kill_UNLOCK() that I've added
}
extern "C" void wsrep_thd_UNLOCK(const THD *thd) { mysql_mutex_unlock(&thd->LOCK_thd_data); + mysql_mutex_unlock(&thd->LOCK_thd_kill); }
extern "C" void wsrep_thd_kill_LOCK(const THD *thd) @@ -295,8 +301,6 @@ extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd) default: return false; } - - return false;
this looks like it begs for the compiler warning. please, keep the return where it was.
}
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org