summaryrefslogtreecommitdiff
path: root/sql/event_scheduler.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2021-08-03 07:00:34 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2021-08-16 15:48:53 +0300
commit2736e9054e9d9ddddba931f57966e44a0cedd0c7 (patch)
treee08d41f3a4736632ab111b762c945ab3a027fd8d /sql/event_scheduler.cc
parent4cd063b9e40cfb77413bcd44bc7d922c6228f810 (diff)
downloadmariadb-git-10.2-MDEV-25114.tar.gz
MDEV-24114 : Crash: WSREP: invalid state ROLLED_BACK (FATAL)10.2-MDEV-25114
Reverts fix for MDEV-23328 i.e. commit 29bbcac0ee841 In this fix we try to modify normal SQL KILL in a following way: trx_id= thd_to_trx(victim_thd)->id; mutex_unlock(victim_thd->LOCK_thd_data); mutex_unlock(victim_thd->LOCK_thd_kill); lock_mutex_enter trx=find_and_lock_trx_by_id(trx_id) mytex_lock(trx->mysql_thd->LOCK_thd_kill); mutex_lock(trx->mysql_thd->LOCK_thd_data) For THD::awake() we use: mutex_lock(thd->LOCK_thd_kill); mutex_lock(thd->LOCK_thd_data); thd->awake(); mutex_unlock(thd->LOCK_thd_data); mutex_unlock(thd->LOCK_thd_kill); For THD::set_killed in most cases we use mutex_lock(thd->LOCK_thd_kill); mutex_lock(thd->LOCK_thd_data); thd->set_killed_no_mutex(...); mutex_unlock(thd->LOCK_thd_data); mutex_unlock(thd->LOCK_thd_kill);
Diffstat (limited to 'sql/event_scheduler.cc')
-rw-r--r--sql/event_scheduler.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index 423f7e6ea2b..799a689e1c6 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -650,7 +650,8 @@ Event_scheduler::stop()
state= STOPPING;
DBUG_PRINT("info", ("Scheduler thread has id %lu",
(ulong) scheduler_thd->thread_id));
- /* Lock from delete */
+ /* Lock from concurrent usage and delete/kill */
+ mysql_mutex_lock(&scheduler_thd->LOCK_thd_kill);
mysql_mutex_lock(&scheduler_thd->LOCK_thd_data);
/* This will wake up the thread if it waits on Queue's conditional */
sql_print_information("Event Scheduler: Killing the scheduler thread, "
@@ -658,6 +659,7 @@ Event_scheduler::stop()
(ulong) scheduler_thd->thread_id);
scheduler_thd->awake(KILL_CONNECTION);
mysql_mutex_unlock(&scheduler_thd->LOCK_thd_data);
+ mysql_mutex_unlock(&scheduler_thd->LOCK_thd_kill);
/* thd could be 0x0, when shutting down */
sql_print_information("Event Scheduler: "