summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2021-10-22 09:50:11 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2021-10-29 09:52:40 +0300
commitaa7ca987db05bae47645578e1233d43874b6a14d (patch)
treeb9d5ca1f9e0d56882a64faece202f6c825de45e0 /sql/log_event.cc
parente10838268e4669840499a508f8997dfe86fa3771 (diff)
downloadmariadb-git-aa7ca987db05bae47645578e1233d43874b6a14d.tar.gz
MDEV-25114: Crash: WSREP: invalid state ROLLED_BACK (FATAL)
Revert "MDEV-23328 Server hang due to Galera lock conflict resolution" This reverts commit eac8341df4c3c7b98360f4e9498acf393dc055e3.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc22
1 files changed, 8 insertions, 14 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 62a65d002b7..c1c753d69fd 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -8985,20 +8985,8 @@ err:
}
#endif /* MYSQL_CLIENT */
-#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;
- mysql_mutex_unlock(&thd->LOCK_thd_data);
- return res;
-#else
- return false;
-#endif
-}
-
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Xid_log_event::do_apply_event(rpl_group_info *rgi)
{
bool res;
@@ -9063,8 +9051,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();
- if (sub_id && (!res || wsrep_must_replay(thd)))
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+#ifdef WITH_WSREP
+ if (sub_id && (!res || (WSREP(thd) && thd->wsrep_trx().state() == wsrep::transaction::s_must_replay)))
+#else
+ if (sub_id && !res)
+#endif /* WITH_WSREP */
rpl_global_gtid_slave_state->update_state_hash(sub_id, &gtid, hton, rgi);
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
/*
Increment the global status commit count variable
*/