diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h index e9c3b0fa86a..671ef515135 100644 --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@ -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); diff --git a/include/service_versions.h b/include/service_versions.h index 6e138fab5a4..09ba702a225 100644 --- a/include/service_versions.h +++ b/include/service_versions.h @@ -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 diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic index a97aaed831a..784ba5c9068 100644 --- a/sql/sql_plugin_services.ic +++ b/sql/sql_plugin_services.ic @@ -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= diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index de234770788..f57be3a8611 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -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();