From d5d11998792f1bc88a8e506593bc3a29b7bd5334 Mon Sep 17 00:00:00 2001 From: AliSQL Date: Tue, 10 Oct 2017 14:53:44 +0800 Subject: [PATCH] [Bugfix] Issue#54 The ACK Receiver Thread didn't handle signal correctly Description =========== Ack Receiver thread will be launched when booting the MySQL server, but it is before the signal register, so the thread can receive the signal, and can't deal with shutdown smoothly like 'SIGTERM, SIGHUP'. --- sql/mysqld.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e09a1a8da98..6572c3c7ed7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4103,12 +4103,6 @@ int init_common_variables() if (thread_running_high_watermark == 0) thread_running_high_watermark= max_connections; -#ifdef HAVE_REPLICATION - if (repl_semisync_master.initObject() || - repl_semisync_slave.initObject()) - return 1; -#endif - unireg_init(opt_specialflag); /* Set up extern variabels */ if (!(my_default_lc_messages= my_locale_by_name(lc_messages))) @@ -5537,6 +5531,12 @@ int mysqld_main(int argc, char **argv) my_init_signals(); +#ifdef HAVE_REPLICATION + if (repl_semisync_master.initObject() || + repl_semisync_slave.initObject()) + unireg_abort(1); // Will do exit +#endif + size_t guardize= 0; int retval= pthread_attr_getguardsize(&connection_attrib, &guardize); DBUG_ASSERT(retval == 0);