summaryrefslogtreecommitdiff
path: root/sql/wsrep_mysqld.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2018-11-22 16:30:20 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2018-11-26 08:11:56 +0200
commit244cc35e7b929376e445adad8996de154ebc9c8f (patch)
tree4884474635901ffddb2d8bbe7fe0c4f687c0792d /sql/wsrep_mysqld.cc
parent8324e5e84dc786b2d4a07d7798f26ddea239159e (diff)
downloadmariadb-git-244cc35e7b929376e445adad8996de154ebc9c8f.tar.gz
MDEV-17801: Galera test failure on galera_var_reject_queries
Problem was that controlling connection i.e. connection that executed the query SET GLOBAL wsrep_reject_queries = ALL_KILL; was also killed but server would try to send result from that query to controlling connection resulting a assertion mysqld: /home/jan/mysql/10.2-sst/include/mysql/psi/mysql_socket.h:738: inline_mysql_socket_send: Assertion `mysql_socket.fd != -1' failed. as socket was closed when controlling connection was closed. wsrep_close_client_connections() Do not close controlling connection and instead of wsrep_close_thread() we do now soft kill by THD::awake wsrep_reject_queries_update() Call wsrep_close_client_connections using current thd.
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r--sql/wsrep_mysqld.cc22
1 files changed, 19 insertions, 3 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);