From 6e1f446ae1f8484e069539c415818d9b9bd511e3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Mar 2007 13:38:42 +0200 Subject: [PATCH 01/10] move thr_client_alarm initialization to mysqld.cc (in thr_alarm.cc it happened too late). mysys/thr_alarm.c: move thr_client_alarm initialization to mysqld.cc (here it happened too late) sql/mysqld.cc: move thr_client_alarm initialization to mysqld.cc (in thr_alarm.cc it happened too late). moved thr_kill_signal initialization to init_signals() --- mysys/thr_alarm.c | 4 ---- sql/mysqld.cc | 14 +++++++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 759544af17b..396623dea21 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -78,10 +78,6 @@ 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 a3263b50951..0e9131389c9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2046,6 +2046,17 @@ 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); @@ -3140,9 +3151,6 @@ int main(int argc, char **argv) MY_INIT(argv[0]); // init my_sys library & pthreads - /* Set signal used to kill MySQL */ - thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2; - #ifdef _CUSTOMSTARTUPCONFIG_ if (_cust_check_startup()) { From d89329c68586b11984d86f3701f08c4a08f0a895 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Mar 2007 20:37:20 +0200 Subject: [PATCH 02/10] reverted linuxthreads thr_client_alarm fix (not future-proof) fixed differently: wake up select_thread with THR_SERVER_ALARM instead mysys/thr_alarm.c: reverted linuxthreads thr_client_alarm fix (not future-proof) --- 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 85e1718e000e74a324c6f5281af111b7b7e4b104 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Mar 2007 22:16:32 +0200 Subject: [PATCH 03/10] 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 a1e7490f411ac2d47c9fd548922e7f0fa21e4e26 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 24 Mar 2007 14:03:27 +0200 Subject: [PATCH 04/10] 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_ From 0d5a969acea2297d459f8f23c0030796a68cf00e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Mar 2007 17:42:55 +0200 Subject: [PATCH 05/10] mysql.spec.sh, Makefile.am: Don't use explicit calls to mysql-test-run in spec Makefile.am: Don't use explicit calls to mysql-test-run in spec support-files/mysql.spec.sh: Don't use explicit calls to mysql-test-run in spec --- Makefile.am | 6 ++++++ support-files/mysql.spec.sh | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 70ed8fa7bfe..f620f5d8ab8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -132,6 +132,12 @@ test-force-full: test-force-mem: $(MAKE) 'force=--force --mem' test +test-bt: + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --force --comment=normal --report-features + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol + # Keep these for a while test-pl: test test-full-pl: test-full diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 15c3e4910d8..ab544b65f74 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -319,10 +319,7 @@ then cp -fp config.log "$MYSQL_MAXCONFLOG_DEST" fi -( cd mysql-test - perl ./mysql-test-run.pl --force --report-features - perl ./mysql-test-run.pl --force --ps-protocol - true ) +make test-bt # Save mysqld-max ./libtool --mode=execute cp sql/mysqld sql/mysqld-max From f8eed3c1cef8049a81839fb8d526719437bc0d0b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Mar 2007 15:33:29 +0200 Subject: [PATCH 06/10] restored run-time thread lib detection sql/stacktrace.c: removed code duplication sql/stacktrace.h: removed code duplication --- include/my_pthread.h | 9 +++++++++ include/thr_alarm.h | 8 +++----- mysys/my_pthread.c | 10 +++++----- mysys/my_thr_init.c | 21 +++++++++++++++++++++ mysys/thr_alarm.c | 44 ++++++++++++++++++++++---------------------- sql/mysqld.cc | 34 +++++++++++++++++++--------------- sql/stacktrace.c | 17 ++--------------- sql/stacktrace.h | 2 -- 8 files changed, 81 insertions(+), 64 deletions(-) diff --git a/include/my_pthread.h b/include/my_pthread.h index 4df105e1b20..340dc32981a 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -701,6 +701,15 @@ extern uint my_thread_end_wait_time; Keep track of shutdown,signal, and main threads so that my_end() will not report errors with them */ + +/* Which kind of thread library is in use */ + +#define THD_LIB_OTHER 1 +#define THD_LIB_NPTL 2 +#define THD_LIB_LT 4 + +extern uint thd_lib_detected; + /* statistics_xxx functions are for not essential statistic */ #ifndef thread_safe_increment diff --git a/include/thr_alarm.h b/include/thr_alarm.h index 14dd538c9e4..a2694ba105b 100644 --- a/include/thr_alarm.h +++ b/include/thr_alarm.h @@ -24,11 +24,6 @@ extern "C" { #ifndef USE_ALARM_THREAD #define USE_ONE_SIGNAL_HAND /* One must call process_alarm */ #endif -#ifdef HAVE_LINUXTHREADS -#define THR_CLIENT_ALARM SIGALRM -#else -#define THR_CLIENT_ALARM SIGUSR1 -#endif #ifdef HAVE_rts_threads #undef USE_ONE_SIGNAL_HAND #define USE_ALARM_THREAD @@ -90,6 +85,9 @@ typedef struct st_alarm { my_bool malloced; } ALARM; +extern uint thr_client_alarm; +extern pthread_t alarm_thread; + #define thr_alarm_init(A) (*(A))=0 #define thr_alarm_in_use(A) (*(A)!= 0) void init_thr_alarm(uint max_alarm); diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 74ba98c321a..db01602f4ab 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -31,6 +31,8 @@ uint thd_lib_detected= 0; +uint thd_lib_detected; + #ifndef my_pthread_setprio void my_pthread_setprio(pthread_t thread_id,int prior) { @@ -51,8 +53,6 @@ int my_pthread_getprio(pthread_t thread_id) int policy; if (!pthread_getschedparam(thread_id,&policy,&tmp_sched_param)) { - DBUG_PRINT("thread",("policy: %d priority: %d", - policy,tmp_sched_param.sched_priority)); return tmp_sched_param.sched_priority; } #endif @@ -314,8 +314,6 @@ void sigwait_handle_sig(int sig) pthread_mutex_unlock(&LOCK_sigwait); } -extern pthread_t alarm_thread; - void *sigwait_thread(void *set_arg) { sigset_t *set=(sigset_t*) set_arg; @@ -334,7 +332,9 @@ void *sigwait_thread(void *set_arg) sigaction(i, &sact, (struct sigaction*) 0); } } - sigaddset(set,THR_CLIENT_ALARM); + /* Ensure that init_thr_alarm() is called */ + DBUG_ASSERT(thr_client_alarm); + sigaddset(set, thr_client_alarm); pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0); alarm_thread=pthread_self(); /* For thr_alarm */ diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 61e6e640027..464edb77f99 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -20,6 +20,7 @@ #include "mysys_priv.h" #include +#include #ifdef THREAD #ifdef USE_TLS @@ -63,6 +64,8 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused))) #endif +static uint get_thread_lib(void); + /* initialize thread environment @@ -76,6 +79,8 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused))) my_bool my_thread_global_init(void) { + thd_lib_detected= get_thread_lib(); + if (pthread_key_create(&THR_KEY_mysys,0)) { fprintf(stderr,"Can't initialize threads: error %d\n",errno); @@ -395,4 +400,20 @@ const char *my_thread_name(void) } #endif /* DBUG_OFF */ + +static uint get_thread_lib(void) +{ + char buff[64]; + +#ifdef _CS_GNU_LIBPTHREAD_VERSION + confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); + + if (!strncasecmp(buff, "NPTL", 4)) + return THD_LIB_NPTL; + if (!strncasecmp(buff, "linuxthreads", 12)) + return THD_LIB_LT; +#endif + return THD_LIB_OTHER; +} + #endif /* THREAD */ diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 3fd70790281..57670c9ac14 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -34,6 +34,7 @@ #define ETIME ETIMEDOUT #endif +uint thr_client_alarm; static int alarm_aborted=1; /* No alarm thread */ my_bool thr_alarm_inited= 0; volatile my_bool alarm_thread_running= 0; @@ -56,9 +57,7 @@ static void *alarm_handler(void *arg); #define reschedule_alarms() pthread_kill(alarm_thread,THR_SERVER_ALARM) #endif -#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD) static sig_handler thread_alarm(int sig __attribute__((unused))); -#endif static int compare_ulong(void *not_used __attribute__((unused)), byte *a_ptr,byte* b_ptr) @@ -77,9 +76,13 @@ 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 THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD) - my_sigset(THR_CLIENT_ALARM,thread_alarm); + thr_client_alarm= thd_lib_detected == THD_LIB_LT ? SIGALRM : SIGUSR1; +#ifndef USE_ALARM_THREAD + if (thd_lib_detected != THD_LIB_LT) #endif + { + my_sigset(thr_client_alarm, thread_alarm); + } sigemptyset(&s); sigaddset(&s, THR_SERVER_ALARM); alarm_thread=pthread_self(); @@ -97,10 +100,11 @@ void init_thr_alarm(uint max_alarms) } #elif defined(USE_ONE_SIGNAL_HAND) pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */ -#if THR_SERVER_ALARM == THR_CLIENT_ALARM - my_sigset(THR_CLIENT_ALARM,process_alarm); /* Linuxthreads */ - pthread_sigmask(SIG_UNBLOCK, &s, NULL); -#endif + if (thd_lib_detected == THD_LIB_LT) + { + my_sigset(thr_client_alarm, process_alarm); /* Linuxthreads */ + pthread_sigmask(SIG_UNBLOCK, &s, NULL); + } #else my_sigset(THR_SERVER_ALARM, process_alarm); pthread_sigmask(SIG_UNBLOCK, &s, NULL); @@ -152,7 +156,7 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data) now=(ulong) time((time_t*) 0); pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask); - pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */ + pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */ if (alarm_aborted > 0) { /* No signal thread */ DBUG_PRINT("info", ("alarm aborted")); @@ -273,18 +277,17 @@ sig_handler process_alarm(int sig __attribute__((unused))) This must be first as we can't call DBUG inside an alarm for a normal thread */ -#if THR_SERVER_ALARM == THR_CLIENT_ALARM - if (!pthread_equal(pthread_self(),alarm_thread)) + if (thd_lib_detected == THD_LIB_LT && + !pthread_equal(pthread_self(),alarm_thread)) { #if defined(MAIN) && !defined(__bsdi__) printf("thread_alarm in process_alarm\n"); fflush(stdout); #endif #ifdef DONT_REMEMBER_SIGNAL - my_sigset(THR_CLIENT_ALARM,process_alarm); /* int. thread system calls */ + my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */ #endif return; } -#endif /* We have to do do the handling of the alarm in a sub function, @@ -328,7 +331,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused))) alarm_data=(ALARM*) queue_element(&alarm_queue,i); alarm_data->alarmed=1; /* Info to thread */ if (pthread_equal(alarm_data->thread,alarm_thread) || - pthread_kill(alarm_data->thread, THR_CLIENT_ALARM)) + pthread_kill(alarm_data->thread, thr_client_alarm)) { #ifdef MAIN printf("Warning: pthread_kill couldn't find thread!!!\n"); @@ -352,7 +355,7 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused))) alarm_data->alarmed=1; /* Info to thread */ DBUG_PRINT("info",("sending signal to waiting thread")); if (pthread_equal(alarm_data->thread,alarm_thread) || - pthread_kill(alarm_data->thread, THR_CLIENT_ALARM)) + pthread_kill(alarm_data->thread, thr_client_alarm)) { #ifdef MAIN printf("Warning: pthread_kill couldn't find thread!!!\n"); @@ -488,7 +491,7 @@ void thr_alarm_info(ALARM_INFO *info) ARGSUSED */ -#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD) + static sig_handler thread_alarm(int sig) { #ifdef MAIN @@ -498,7 +501,6 @@ static sig_handler thread_alarm(int sig) my_sigset(sig,thread_alarm); /* int. thread system calls */ #endif } -#endif #ifdef HAVE_TIMESPEC_TS_SEC @@ -784,9 +786,7 @@ static void *signal_hand(void *arg __attribute__((unused))) sigaddset(&set,SIGINT); sigaddset(&set,SIGQUIT); sigaddset(&set,SIGTERM); -#if THR_CLIENT_ALARM != SIGHUP sigaddset(&set,SIGHUP); -#endif #ifdef SIGTSTP sigaddset(&set,SIGTSTP); #endif @@ -797,7 +797,7 @@ static void *signal_hand(void *arg __attribute__((unused))) puts("Starting signal handling thread"); #endif printf("server alarm: %d thread alarm: %d\n", - THR_SERVER_ALARM,THR_CLIENT_ALARM); + THR_SERVER_ALARM, thr_client_alarm); DBUG_PRINT("info",("Starting signal and alarm handling thread")); for(;;) { @@ -865,11 +865,11 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) sigaddset(&set,SIGTSTP); #endif sigaddset(&set,THR_SERVER_ALARM); - sigdelset(&set,THR_CLIENT_ALARM); + sigdelset(&set, thr_client_alarm); (void) pthread_sigmask(SIG_SETMASK,&set,NULL); #ifdef NOT_USED sigemptyset(&set); - sigaddset(&set,THR_CLIENT_ALARM); + sigaddset(&set, thr_client_alarm); VOID(pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0)); #endif diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a0687929de5..c5933484675 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -195,12 +195,6 @@ inline void reset_floating_point_exceptions() } /* cplusplus */ - -#if defined(HAVE_LINUXTHREADS) -#define THR_KILL_SIGNAL SIGINT -#else -#define THR_KILL_SIGNAL SIGUSR2 // Can't use this with LinuxThreads -#endif #define MYSQL_KILL_SIGNAL SIGTERM #ifdef HAVE_GLIBC2_STYLE_GETHOSTBYNAME_R @@ -605,6 +599,7 @@ pthread_mutex_t LOCK_server_started; pthread_cond_t COND_server_started; int mysqld_server_started= 0; +static uint thr_kill_signal; File_parser_dummy_hook file_parser_dummy_hook; @@ -788,7 +783,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_client_alarm)) break; // allready dead #endif set_timespec(abstime, 2); @@ -2294,7 +2289,9 @@ static void init_signals(void) DBUG_ENTER("init_signals"); if (test_flags & TEST_SIGINT) - my_sigset(THR_KILL_SIGNAL,end_thread_signal); + { + my_sigset(thr_kill_signal, end_thread_signal); + } my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called! if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL)) @@ -2351,8 +2348,12 @@ static void init_signals(void) #endif sigaddset(&set,THR_SERVER_ALARM); if (test_flags & TEST_SIGINT) - sigdelset(&set,THR_KILL_SIGNAL); // May be SIGINT - sigdelset(&set,THR_CLIENT_ALARM); // For alarms + { + // 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; @@ -2415,23 +2416,19 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) */ init_thr_alarm(thread_scheduler.max_threads + global_system_variables.max_insert_delayed_threads + 10); -#if SIGINT != THR_KILL_SIGNAL - if (test_flags & TEST_SIGINT) + if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT)) { (void) sigemptyset(&set); // Setup up SIGINT for debug (void) sigaddset(&set,SIGINT); // For debugging (void) pthread_sigmask(SIG_UNBLOCK,&set,NULL); } -#endif (void) sigemptyset(&set); // Setup up SIGINT for debug #ifdef USE_ONE_SIGNAL_HAND (void) sigaddset(&set,THR_SERVER_ALARM); // For alarms #endif #ifndef IGNORE_SIGHUP_SIGQUIT (void) sigaddset(&set,SIGQUIT); -#if THR_CLIENT_ALARM != SIGHUP (void) sigaddset(&set,SIGHUP); -#endif #endif (void) sigaddset(&set,SIGTERM); (void) sigaddset(&set,SIGTSTP); @@ -3626,6 +3623,13 @@ int main(int argc, char **argv) MY_INIT(argv[0]); // init my_sys library & pthreads /* nothing should come before this line ^^^ */ + /* Set signal used to kill MySQL */ +#if defined(SIGUSR2) + thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2; +#else + thr_kill_signal= SIGINT; +#endif + /* Perform basic logger initialization logger. Should be called after MY_INIT, as it initializes mutexes. Log tables are inited later. diff --git a/sql/stacktrace.c b/sql/stacktrace.c index d8e9b7fd883..0dbf4522a71 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -55,19 +55,6 @@ void safe_print_str(const char* name, const char* val, int max_len) static my_bool is_nptl; -/* Check if we are using NPTL or LinuxThreads on Linux */ -void check_thread_lib(void) -{ - char buf[5]; - -#ifdef _CS_GNU_LIBPTHREAD_VERSION - confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf)); - is_nptl = !strncasecmp(buf, "NPTL", sizeof(buf)); -#else - is_nptl = 0; -#endif -} - #if defined(__alpha__) && defined(__GNUC__) /* The only way to backtrace without a symbol table on alpha @@ -173,8 +160,8 @@ terribly wrong...\n"); #endif /* __alpha__ */ /* We are 1 frame above signal frame with NPTL and 2 frames above with LT */ - sigreturn_frame_count = is_nptl ? 1 : 2; - + sigreturn_frame_count = thd_lib_detected == THD_LIB_LT ? 2 : 1; + while (fp < (uchar**) stack_bottom) { #if defined(__i386__) || defined(__x86_64__) diff --git a/sql/stacktrace.h b/sql/stacktrace.h index f5c92e54e1c..56b9877180a 100644 --- a/sql/stacktrace.h +++ b/sql/stacktrace.h @@ -27,11 +27,9 @@ extern char* heap_start; #define init_stacktrace() do { \ heap_start = (char*) &__bss_start; \ - check_thread_lib(); \ } while(0); void print_stacktrace(gptr stack_bottom, ulong thread_stack); void safe_print_str(const char* name, const char* val, int max_len); -void check_thread_lib(void); #endif /* (defined (__i386__) || (defined(__alpha__) && defined(__GNUC__))) */ #endif /* TARGET_OS_LINUX */ From 2cdd8359ef3d4052e8bfa2effe660ff87ea00649 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Mar 2007 17:12:38 +0200 Subject: [PATCH 07/10] compiler warnings --- sql/mysqld.cc | 2 +- sql/stacktrace.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ce53cd22669..51feb197713 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -599,7 +599,6 @@ pthread_mutex_t LOCK_server_started; pthread_cond_t COND_server_started; int mysqld_server_started= 0; -static uint thr_kill_signal; File_parser_dummy_hook file_parser_dummy_hook; @@ -633,6 +632,7 @@ struct rand_struct sql_rand; // used by sql_class.cc:THD::THD() #ifndef EMBEDDED_LIBRARY struct passwd *user_info; static pthread_t select_thread; +static uint thr_kill_signal; #endif /* OS specific variables */ diff --git a/sql/stacktrace.c b/sql/stacktrace.c index 0dbf4522a71..078f62c6b2b 100644 --- a/sql/stacktrace.c +++ b/sql/stacktrace.c @@ -53,8 +53,6 @@ void safe_print_str(const char* name, const char* val, int max_len) #define SIGRETURN_FRAME_OFFSET 23 #endif -static my_bool is_nptl; - #if defined(__alpha__) && defined(__GNUC__) /* The only way to backtrace without a symbol table on alpha From d167071bed81f3dccf109b79b2a2fe77eccfd3c0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Mar 2007 19:01:49 +0200 Subject: [PATCH 08/10] mysys/my_thr_init.c : Avoid warnings of "unused variable" by extending a '#ifdef'. mysys/my_thr_init.c: Enclose a variable declaration in the same '#ifdef' that also controls all access to the variable. This avoids warnings of "unused variable". --- mysys/my_thr_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 464edb77f99..75da07390ba 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -403,9 +403,9 @@ const char *my_thread_name(void) static uint get_thread_lib(void) { +#ifdef _CS_GNU_LIBPTHREAD_VERSION char buff[64]; -#ifdef _CS_GNU_LIBPTHREAD_VERSION confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); if (!strncasecmp(buff, "NPTL", 4)) From 406fd12ad42268b42631c27772a292d5787ff0a4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Mar 2007 23:00:50 +0200 Subject: [PATCH 09/10] configure.in: Don't install ndb man pages if no ndb configured config-win.h, CMakeLists.txt, README, configure.js: Removed Cybozu patches configure.in: Don't install ndb man pages if no ndb configured CMakeLists.txt: Removed Cybozu patches include/config-win.h: Removed Cybozu patches win/README: Removed Cybozu patches win/configure.js: Removed Cybozu patches --- CMakeLists.txt | 3 --- configure.in | 12 +++++++++--- include/config-win.h | 14 -------------- win/README | 1 - win/configure.js | 1 - 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a76361693a..3a286071bb0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,9 +80,6 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-small.cnf.sh IF(__NT__) ADD_DEFINITIONS(-D __NT__) ENDIF(__NT__) -IF(CYBOZU) - ADD_DEFINITIONS(-D CYBOZU) -ENDIF(CYBOZU) # in some places we use DBUG_OFF SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D DBUG_OFF") diff --git a/configure.in b/configure.in index 7867bf444ad..9b0505a594f 100644 --- a/configure.in +++ b/configure.in @@ -2376,12 +2376,18 @@ AC_ARG_WITH(man, [with_man=yes] ) -if test "$with_man" = "yes" +if test X"$with_man" = Xyes then man_dirs="man" - man1_files=`ls -1 $srcdir/man/*.1 | sed -e 's;^.*man/;;'` + if test X"$have_ndbcluster" = Xyes + then + man1_files=`ls $srcdir/man/*.1 | sed -e 's;^.*man/;;'` + man8_files=`ls $srcdir/man/*.8 | sed -e 's;^.*man/;;'` + else + man1_files=`ls $srcdir/man/*.1 | grep -v '/ndb' | sed -e 's;^.*man/;;'` + man8_files=`ls $srcdir/man/*.8 | grep -v '/ndb' | sed -e 's;^.*man/;;'` + fi man1_files=`echo $man1_files` - man8_files=`ls -1 $srcdir/man/*.8 | sed -e 's;^.*man/;;'` man8_files=`echo $man8_files` else man_dirs="" diff --git a/include/config-win.h b/include/config-win.h index 34e828e01e8..279be7aa5e4 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -408,14 +408,8 @@ inline double ulonglong2double(ulonglong value) #define shared_memory_buffer_length 16000 #define default_shared_memory_base_name "MYSQL" -#ifdef CYBOZU -#define MYSQL_DEFAULT_CHARSET_NAME "utf8" -#define MYSQL_DEFAULT_COLLATION_NAME "utf8_general_cs" -#define HAVE_UTF8_GENERAL_CS 1 -#else #define MYSQL_DEFAULT_CHARSET_NAME "latin1" #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" -#endif #define HAVE_SPATIAL 1 #define HAVE_RTREE_KEYS 1 @@ -426,10 +420,8 @@ inline double ulonglong2double(ulonglong value) /* Define charsets you want */ /* #undef HAVE_CHARSET_armscii8 */ /* #undef HAVE_CHARSET_ascii */ -#ifndef CYBOZU #define HAVE_CHARSET_big5 1 #define HAVE_CHARSET_cp1250 1 -#endif /* #undef HAVE_CHARSET_cp1251 */ /* #undef HAVE_CHARSET_cp1256 */ /* #undef HAVE_CHARSET_cp1257 */ @@ -438,33 +430,27 @@ inline double ulonglong2double(ulonglong value) /* #undef HAVE_CHARSET_cp866 */ #define HAVE_CHARSET_cp932 1 /* #undef HAVE_CHARSET_dec8 */ -#ifndef CYBOZU #define HAVE_CHARSET_eucjpms 1 #define HAVE_CHARSET_euckr 1 #define HAVE_CHARSET_gb2312 1 #define HAVE_CHARSET_gbk 1 -#endif /* #undef HAVE_CHARSET_greek */ /* #undef HAVE_CHARSET_hebrew */ /* #undef HAVE_CHARSET_hp8 */ /* #undef HAVE_CHARSET_keybcs2 */ /* #undef HAVE_CHARSET_koi8r */ /* #undef HAVE_CHARSET_koi8u */ -#ifndef CYBOZU #define HAVE_CHARSET_latin1 1 #define HAVE_CHARSET_latin2 1 -#endif /* #undef HAVE_CHARSET_latin5 */ /* #undef HAVE_CHARSET_latin7 */ /* #undef HAVE_CHARSET_macce */ /* #undef HAVE_CHARSET_macroman */ #define HAVE_CHARSET_sjis 1 /* #undef HAVE_CHARSET_swe7 */ -#ifndef CYBOZU #define HAVE_CHARSET_tis620 1 #define HAVE_CHARSET_ucs2 1 #define HAVE_CHARSET_ujis 1 -#endif #define HAVE_CHARSET_utf8 1 #define HAVE_UCA_COLLATIONS 1 diff --git a/win/README b/win/README index 8fe3dc21d1e..871ae4efee7 100644 --- a/win/README +++ b/win/README @@ -48,7 +48,6 @@ The options right now are MYSQL_SERVER_SUFFIX= Server suffix, default none COMPILATION_COMMENT= Server comment, default "Source distribution" MYSQL_TCP_PORT= Server port, default 3306 - CYBOZU DISABLE_GRANT_OPTIONS Disables the use of --init-file and --skip-grant-tables options of mysqld.exe diff --git a/win/configure.js b/win/configure.js index 59c73fc2fab..3488efacba3 100755 --- a/win/configure.js +++ b/win/configure.js @@ -46,7 +46,6 @@ try case "WITH_INNOBASE_STORAGE_ENGINE": case "WITH_PARTITION_STORAGE_ENGINE": case "__NT__": - case "CYBOZU": case "DISABLE_GRANT_OPTIONS": configfile.WriteLine("SET (" + args.Item(i) + " TRUE)"); break; From 53b9d044dba0221892a192fc456972ceeffed16e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Mar 2007 23:18:43 +0200 Subject: [PATCH 10/10] Makefile.am: Extended test section Removed duplicate EXTRA_DIST client/Makefile.am: Removed duplicate EXTRA_DIST Makefile.am: Extended test section --- Makefile.am | 18 +++++++++++++++--- client/Makefile.am | 3 +-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index d742539da26..c4a4a040a40 100644 --- a/Makefile.am +++ b/Makefile.am @@ -149,13 +149,25 @@ test-force-mem: test-bt: -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=normal --report-features + @PERL@ ./mysql-test-run.pl --comment=normal --force --timer \ + --skip-ndbcluster --report-features -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol + @PERL@ ./mysql-test-run.pl --comment=ps --force --timer \ + --skip-ndbcluster --ps-protocol + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --comment=normal+rowrepl --force --timer \ + --skip-ndbcluster --mysqld=--binlog-format=row + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --comment=ps+rowrepl+NDB --force --timer \ + --ps-protocol --mysqld=--binlog-format=row + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --comment=NDB --force --timer \ + --with-ndbcluster-only test-bt-debug: -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=debug --report-features + @PERL@ ./mysql-test-run.pl --comment=debug --force --timer \ + --skip-ndbcluster --skip-rpl --report-features # Keep these for a while test-pl: test diff --git a/client/Makefile.am b/client/Makefile.am index 1c908ea715e..5960095778b 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -34,7 +34,7 @@ LDADD= @CLIENT_EXTRA_LDFLAGS@ $(CLIENT_THREAD_LIBS) \ noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \ client_priv.h -EXTRA_DIST = get_password.c CMakeLists.txt +EXTRA_DIST = get_password.c CMakeLists.txt echo.c bin_PROGRAMS = mysql \ mysqladmin \ @@ -96,7 +96,6 @@ DEFS = -DUNDEF_THREADS_HACK \ sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc strings_src=decimal.c -EXTRA_DIST = get_password.c CMakeLists.txt echo.c link_sources: for f in $(sql_src) ; do \