From 6a204546ef91aa90dedb6b47353bbb568f0531b0 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Tue, 24 Mar 2015 16:41:04 -0400 Subject: [PATCH] MDEV-7798: mysql.server init script can't stop mysqld when WSREP is turned off wsrep threads should be always be checked for existence & stopped on server shutdown. --- mysql-test/suite/wsrep/r/mdev_7798.result | 13 +++++++++++++ mysql-test/suite/wsrep/t/mdev_7798.opt | 1 + mysql-test/suite/wsrep/t/mdev_7798.test | 17 +++++++++++++++++ sql/mysqld.cc | 3 ++- 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/wsrep/r/mdev_7798.result create mode 100644 mysql-test/suite/wsrep/t/mdev_7798.opt create mode 100644 mysql-test/suite/wsrep/t/mdev_7798.test diff --git a/mysql-test/suite/wsrep/r/mdev_7798.result b/mysql-test/suite/wsrep/r/mdev_7798.result new file mode 100644 index 00000000000..83a02f3a606 --- /dev/null +++ b/mysql-test/suite/wsrep/r/mdev_7798.result @@ -0,0 +1,13 @@ +# +# MDEV-7798: mysql.server init script can't stop mysqld when WSREP is +# turned off +# +SELECT @@GLOBAL.WSREP_ON; +@@GLOBAL.WSREP_ON +1 +SET GLOBAL WSREP_ON= 0; +Restart the node. +SELECT @@GLOBAL.WSREP_ON; +@@GLOBAL.WSREP_ON +1 +# End of test. diff --git a/mysql-test/suite/wsrep/t/mdev_7798.opt b/mysql-test/suite/wsrep/t/mdev_7798.opt new file mode 100644 index 00000000000..459a9702707 --- /dev/null +++ b/mysql-test/suite/wsrep/t/mdev_7798.opt @@ -0,0 +1 @@ +--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 --wsrep_causal_reads=ON diff --git a/mysql-test/suite/wsrep/t/mdev_7798.test b/mysql-test/suite/wsrep/t/mdev_7798.test new file mode 100644 index 00000000000..9dfff0959bc --- /dev/null +++ b/mysql-test/suite/wsrep/t/mdev_7798.test @@ -0,0 +1,17 @@ +--source include/have_wsrep_provider.inc +--source include/have_binlog_format_row.inc + +--echo # +--echo # MDEV-7798: mysql.server init script can't stop mysqld when WSREP is +--echo # turned off +--echo # + +SELECT @@GLOBAL.WSREP_ON; +SET GLOBAL WSREP_ON= 0; + +--echo Restart the node. +--source include/restart_mysqld.inc + +SELECT @@GLOBAL.WSREP_ON; + +--echo # End of test. diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 857317a927c..6b960c6db27 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1753,7 +1753,8 @@ static void __cdecl kill_server(int sig_ptr) } #endif #ifdef WITH_WSREP - if (WSREP_ON) wsrep_stop_replication(NULL); + /* Stop wsrep threads in case they are running. */ + wsrep_stop_replication(NULL); #endif close_connections();