summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/wsrep_mysqld.cc22
-rw-r--r--sql/wsrep_mysqld.h4
-rw-r--r--sql/wsrep_var.cc3
3 files changed, 23 insertions, 6 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index c3f5dd1ce97..47aea6d3824 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -2229,7 +2229,7 @@ int wsrep_wait_committing_connections_close(int wait_time)
}
-void wsrep_close_client_connections(my_bool wait_to_end)
+void wsrep_close_client_connections(my_bool wait_to_end, THD *except_caller_thd)
{
/*
First signal all threads that it's time to die
@@ -2251,6 +2251,12 @@ void wsrep_close_client_connections(my_bool wait_to_end)
if (!is_client_connection(tmp))
continue;
+ if (tmp == except_caller_thd)
+ {
+ DBUG_ASSERT(is_client_connection(tmp));
+ continue;
+ }
+
if (is_replaying_connection(tmp))
{
tmp->set_killed(KILL_CONNECTION);
@@ -2262,7 +2268,16 @@ void wsrep_close_client_connections(my_bool wait_to_end)
continue;
WSREP_DEBUG("closing connection %ld", tmp->thread_id);
- wsrep_close_thread(tmp);
+
+ /*
+ 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);
@@ -2280,7 +2295,8 @@ void wsrep_close_client_connections(my_bool wait_to_end)
#ifndef __bsdi__ // Bug in BSDI kernel
if (is_client_connection(tmp) &&
!abort_replicated(tmp) &&
- !is_replaying_connection(tmp))
+ !is_replaying_connection(tmp) &&
+ tmp != except_caller_thd)
{
WSREP_INFO("killing local connection: %ld",tmp->thread_id);
close_connection(tmp,0);
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index 43f0d53393d..2814f4013d8 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -161,7 +161,6 @@ extern "C" query_id_t wsrep_thd_query_id(THD *thd);
extern "C" query_id_t wsrep_thd_wsrep_last_query_id(THD *thd);
extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id);
-extern void wsrep_close_client_connections(my_bool wait_to_end);
extern int wsrep_wait_committing_connections_close(int wait_time);
extern void wsrep_close_applier(THD *thd);
extern void wsrep_wait_appliers_close(THD *thd);
@@ -314,7 +313,8 @@ void thd_binlog_trx_reset(THD * thd);
typedef void (*wsrep_thd_processor_fun)(THD *);
pthread_handler_t start_wsrep_THD(void *arg);
int wsrep_wait_committing_connections_close(int wait_time);
-void wsrep_close_client_connections(my_bool wait_to_end);
+extern void wsrep_close_client_connections(my_bool wait_to_end,
+ THD *except_caller_thd = NULL);
void wsrep_close_applier(THD *thd);
void wsrep_close_applier_threads(int count);
void wsrep_wait_appliers_close(THD *thd);
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index 718676025f9..3959746156a 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -398,7 +398,8 @@ bool wsrep_reject_queries_update(sys_var *self, THD* thd, enum_var_type type)
WSREP_INFO("Rejecting client queries due to manual setting");
break;
case WSREP_REJECT_ALL_KILL:
- wsrep_close_client_connections(FALSE);
+ /* close all client connections, but this one */
+ wsrep_close_client_connections(FALSE, thd);
WSREP_INFO("Rejecting client queries and killing connections due to manual setting");
break;
default: