From d2d72bfc586d3dc1ca28ad03e2ef1853e08af52e Mon Sep 17 00:00:00 2001 From: "serg@sergbook.mysql.com" <> Date: Fri, 23 Mar 2007 20:37:20 +0200 Subject: [PATCH 1/3] reverted linuxthreads thr_client_alarm fix (not future-proof) fixed differently: wake up select_thread with THR_SERVER_ALARM instead --- mysys/thr_alarm.c | 4 ++++ sql/mysqld.cc | 23 ++++++++--------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 396623dea21..759544af17b 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -78,6 +78,10 @@ void init_thr_alarm(uint max_alarms) sigfillset(&full_signal_set); /* Neaded to block signals */ pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST); pthread_cond_init(&COND_alarm,NULL); + if (thd_lib_detected == THD_LIB_LT) + thr_client_alarm= SIGALRM; + else + thr_client_alarm= SIGUSR1; #ifndef USE_ALARM_THREAD if (thd_lib_detected != THD_LIB_LT) #endif diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 903d49a468c..e26bd31a00a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -622,7 +622,7 @@ static void close_connections(void) DBUG_PRINT("info",("Waiting for select thread")); #ifndef DONT_USE_THR_ALARM - if (pthread_kill(select_thread, thr_client_alarm)) + if (pthread_kill(select_thread, THR_SERVER_ALARM)) break; // allready dead #endif set_timespec(abstime, 2); @@ -2062,17 +2062,6 @@ static void init_signals(void) struct sigaction sa; DBUG_ENTER("init_signals"); - if (thd_lib_detected == THD_LIB_LT) - { - thr_client_alarm= SIGALRM; - thr_kill_signal= SIGINT; - } - else - { - thr_client_alarm= SIGUSR1; - thr_kill_signal= SIGUSR2; - } - if (test_flags & TEST_SIGINT) { my_sigset(thr_kill_signal, end_thread_signal); @@ -2131,14 +2120,11 @@ static void init_signals(void) #ifdef SIGTSTP sigaddset(&set,SIGTSTP); #endif - sigaddset(&set,THR_SERVER_ALARM); if (test_flags & TEST_SIGINT) { // May be SIGINT sigdelset(&set, thr_kill_signal); } - // For alarms - sigdelset(&set, thr_client_alarm); sigprocmask(SIG_SETMASK,&set,NULL); pthread_sigmask(SIG_SETMASK,&set,NULL); DBUG_VOID_RETURN; @@ -3167,6 +3153,13 @@ int main(int argc, char **argv) MY_INIT(argv[0]); // init my_sys library & pthreads + /* Set signal used to kill MySQL */ +#if defined(SIGUSR2) + thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2; +#else + thr_kill_signal= thd_lib_detected == SIGINT; +#endif + #ifdef _CUSTOMSTARTUPCONFIG_ if (_cust_check_startup()) { From 77718a3fc19e0e7854a94c4aad3342b04053977c Mon Sep 17 00:00:00 2001 From: "serg@sergbook.mysql.com" <> Date: Fri, 23 Mar 2007 22:16:32 +0200 Subject: [PATCH 2/3] bug in im* tests - missing --no-defaults in the mysql command line --- mysql-test/t/wait_for_socket.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/wait_for_socket.sh b/mysql-test/t/wait_for_socket.sh index 8c17c8ac0ac..2fa7d5c5b7e 100755 --- a/mysql-test/t/wait_for_socket.sh +++ b/mysql-test/t/wait_for_socket.sh @@ -61,7 +61,7 @@ fi ########################################################################### -client_args="--silent --socket=$socket_path --connect_timeout=1 " +client_args="--no-defaults --silent --socket=$socket_path --connect_timeout=1 " [ -n "$username" ] && client_args="$client_args --user=$username " [ -n "$password" ] && client_args="$client_args --password=$password " From 18a01e72619008ad35b749711d5913e03c330968 Mon Sep 17 00:00:00 2001 From: "serg@sergbook.mysql.com" <> Date: Sat, 24 Mar 2007 14:03:27 +0200 Subject: [PATCH 3/3] nptl: typo fixed. sigaddset restored --- sql/mysqld.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e26bd31a00a..51332053df6 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -622,7 +622,7 @@ static void close_connections(void) DBUG_PRINT("info",("Waiting for select thread")); #ifndef DONT_USE_THR_ALARM - if (pthread_kill(select_thread, THR_SERVER_ALARM)) + if (pthread_kill(select_thread, thr_client_alarm)) break; // allready dead #endif set_timespec(abstime, 2); @@ -2120,6 +2120,8 @@ static void init_signals(void) #ifdef SIGTSTP sigaddset(&set,SIGTSTP); #endif + if (thd_lib_detected != THD_LIB_LT) + sigaddset(&set,THR_SERVER_ALARM); if (test_flags & TEST_SIGINT) { // May be SIGINT @@ -3157,7 +3159,7 @@ int main(int argc, char **argv) #if defined(SIGUSR2) thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2; #else - thr_kill_signal= thd_lib_detected == SIGINT; + thr_kill_signal= SIGINT; #endif #ifdef _CUSTOMSTARTUPCONFIG_