Commit 2676c9aa authored by Sergei Golubchik's avatar Sergei Golubchik

galera fixes related to THD::LOCK_thd_kill

Since 2017 (c2118a08) THD::awake() no longer requires LOCK_thd_data.
It uses LOCK_thd_kill, and this latter mutex is used to prevent
a thread of dying, not LOCK_thd_data as before.
parent 251b5219
......@@ -119,6 +119,8 @@ extern struct wsrep_service_st {
my_bool (*wsrep_thd_is_applier_func)(MYSQL_THD);
void (*wsrep_report_bf_lock_wait_func)(MYSQL_THD thd,
unsigned long long trx_id);
void (*wsrep_thd_kill_LOCK_func)(THD *thd);
void (*wsrep_thd_kill_UNLOCK_func)(THD *thd);
} *wsrep_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
......@@ -143,6 +145,8 @@ extern struct wsrep_service_st {
#define wsrep_run_wsrep_commit(T,A) wsrep_service->wsrep_run_wsrep_commit_func(T,A)
#define wsrep_thd_LOCK(T) wsrep_service->wsrep_thd_LOCK_func(T)
#define wsrep_thd_UNLOCK(T) wsrep_service->wsrep_thd_UNLOCK_func(T)
#define wsrep_thd_kill_LOCK(T) wsrep_service->wsrep_thd_kill_LOCK_func(T)
#define wsrep_thd_kill_UNLOCK(T) wsrep_service->wsrep_thd_kill_UNLOCK_func(T)
#define wsrep_thd_awake(T,S) wsrep_service->wsrep_thd_awake_func(T,S)
#define wsrep_thd_conflict_state(T,S) wsrep_service->wsrep_thd_conflict_state_func(T,S)
#define wsrep_thd_conflict_state_str(T) wsrep_service->wsrep_thd_conflict_state_str_func(T)
......@@ -226,6 +230,8 @@ void wsrep_lock_rollback();
void wsrep_post_commit(THD* thd, bool all);
void wsrep_thd_LOCK(THD *thd);
void wsrep_thd_UNLOCK(THD *thd);
void wsrep_thd_kill_LOCK(THD *thd);
void wsrep_thd_kill_UNLOCK(THD *thd);
void wsrep_thd_awake(THD *thd, my_bool signal);
void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state);
bool wsrep_thd_ignore_table(THD *thd);
......
......@@ -41,4 +41,4 @@
#define VERSION_thd_specifics 0x0100
#define VERSION_thd_timezone 0x0100
#define VERSION_thd_wait 0x0100
#define VERSION_wsrep 0x0202
#define VERSION_wsrep 0x0203
......@@ -187,7 +187,9 @@ static struct wsrep_service_st wsrep_handler = {
wsrep_unlock_rollback,
wsrep_set_data_home_dir,
wsrep_thd_is_applier,
wsrep_report_bf_lock_wait
wsrep_report_bf_lock_wait,
wsrep_thd_kill_LOCK,
wsrep_thd_kill_UNLOCK
};
static struct thd_specifics_service_st thd_specifics_handler=
......
......@@ -2383,12 +2383,7 @@ void wsrep_close_client_connections(my_bool wait_to_end, THD *except_caller_thd)
/*
instead of wsrep_close_thread() we do now soft kill by THD::awake
*/
mysql_mutex_lock(&tmp->LOCK_thd_data);
tmp->awake(KILL_CONNECTION);
mysql_mutex_unlock(&tmp->LOCK_thd_data);
}
mysql_mutex_unlock(&LOCK_thread_count);
......@@ -2676,6 +2671,18 @@ void wsrep_thd_UNLOCK(THD *thd)
}
void wsrep_thd_kill_LOCK(THD *thd)
{
mysql_mutex_lock(&thd->LOCK_thd_kill);
}
void wsrep_thd_kill_UNLOCK(THD *thd)
{
mysql_mutex_unlock(&thd->LOCK_thd_kill);
}
extern "C" time_t wsrep_thd_query_start(THD *thd)
{
return thd->query_start();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment