#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/ based on revid:guilhem@stripped
2732 Guilhem Bichot 2009-02-12
Fixing problems of previous 5.1-main->5.1-maria merge:
- adding back Serg's "mtr --list-options"
- safe_mutex deadlock detector started raising wrong deadlock warnings, fixed
here by a backport from 6.0-main.
modified:
include/my_pthread.h
mysql-test/mysql-test-run.pl
mysys/my_init.c
mysys/my_thr_init.c
per-file messages:
include/my_pthread.h
Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
in 5.1-main don't), see chad@stripped for explanations
mysql-test/mysql-test-run.pl
adding back Serg's --list-options
mysys/my_init.c
Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
in 5.1-main don't), see chad@stripped for explanations
mysys/my_thr_init.c
Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
in 5.1-main don't), see chad@stripped for explanations
=== modified file 'include/my_pthread.h'
--- a/include/my_pthread.h 2009-01-15 21:27:36 +0000
+++ b/include/my_pthread.h 2009-02-12 15:27:33 +0000
@@ -671,6 +671,7 @@ extern pthread_mutexattr_t my_errorcheck
typedef ulong my_thread_id;
+extern void my_threadattr_global_init(void);
extern my_bool my_thread_global_init(void);
extern void my_thread_global_end(void);
extern my_bool my_thread_init(void);
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2009-02-12 14:08:56 +0000
+++ b/mysql-test/mysql-test-run.pl 2009-02-12 15:27:33 +0000
@@ -118,6 +118,7 @@ our $opt_vs_config = $ENV{'MTR_VS_CONFIG
my $DEFAULT_SUITES= "main,binlog,federated,rpl,rpl_ndb,ndb,maria";
our $opt_usage;
+our $opt_list_options;
our $opt_suites;
our $opt_suites_default= "main,backup,backup_engines,binlog,rpl,rpl_ndb,ndb"; # Default suites to run
our $opt_script_debug= 0; # Script debugging, enable with --script-debug
@@ -770,7 +771,7 @@ sub command_line_setup {
# Read the command line options
# Note: Keep list, and the order, in sync with usage at end of this file
Getopt::Long::Configure("pass_through");
- GetOptions(
+ my %options=(
# Control what engine/variation to run
'embedded-server' => \$opt_embedded_server,
'ps-protocol' => \$opt_ps_protocol,
@@ -891,9 +892,13 @@ sub command_line_setup {
'timediff' => \&report_option,
'help|h' => \$opt_usage,
- ) or usage("Can't read options");
+ 'list-options' => \$opt_list_options,
+ );
+
+ GetOptions(%options) or usage("Can't read options");
usage("") if $opt_usage;
+ list_options(\%options) if $opt_list_options;
# --------------------------------------------------------------------------
# Setup verbosity
@@ -5125,3 +5130,15 @@ HERE
}
+
+sub list_options ($) {
+ my $hash= shift;
+
+ for (keys %$hash) {
+ s/(=.*|!)$//;
+ s/\|/\n--/g;
+ print "--$_\n";
+ }
+
+ exit(1);
+}
=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c 2009-02-12 14:08:56 +0000
+++ b/mysys/my_init.c 2009-02-12 15:27:33 +0000
@@ -82,20 +82,20 @@ my_bool my_init(void)
my_progname_short= my_progname + dirname_length(my_progname);
#if defined(THREAD)
- if (my_thread_global_init())
- return 1;
+ (void) my_threadattr_global_init();
# if defined(SAFE_MUTEX)
safe_mutex_global_init(); /* Must be called early */
-# endif
-#endif
-#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
+# elif defined(MY_PTHREAD_FASTMUTEX)
fastmutex_global_init(); /* Must be called early */
+# endif
#endif
netware_init();
#ifdef THREAD
#if defined(HAVE_PTHREAD_INIT)
pthread_init(); /* Must be called before DBUG_ENTER */
#endif
+ if (my_thread_global_init())
+ return 1;
#if !defined( __WIN__) && !defined(__NETWARE__)
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
#endif
=== modified file 'mysys/my_thr_init.c'
--- a/mysys/my_thr_init.c 2009-01-15 21:27:36 +0000
+++ b/mysys/my_thr_init.c 2009-02-12 15:27:33 +0000
@@ -65,6 +65,38 @@ nptl_pthread_exit_hack_handler(void *arg
#endif /* TARGET_OS_LINUX */
+
+/**
+ Initialize thread attributes.
+*/
+
+void my_threadattr_global_init(void)
+{
+#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+ /*
+ Set mutex type to "fast" a.k.a "adaptive"
+
+ In this case the thread may steal the mutex from some other thread
+ that is waiting for the same mutex. This will save us some
+ context switches but may cause a thread to 'starve forever' while
+ waiting for the mutex (not likely if the code within the mutex is
+ short).
+ */
+ pthread_mutexattr_init(&my_fast_mutexattr); /* ?= MY_MUTEX_INIT_FAST */
+ pthread_mutexattr_settype(&my_fast_mutexattr,
+ PTHREAD_MUTEX_ADAPTIVE_NP);
+#endif
+#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+ /*
+ Set mutex type to "errorcheck"
+ */
+ pthread_mutexattr_init(&my_errorcheck_mutexattr);
+ pthread_mutexattr_settype(&my_errorcheck_mutexattr,
+ PTHREAD_MUTEX_ERRORCHECK);
+#endif
+}
+
+
static uint get_thread_lib(void);
/*
| Thread |
|---|
| • bzr commit into MySQL/Maria:mysql-maria branch (guilhem:2732) | Guilhem Bichot | 13 Feb |