diff options
author | Andrei Elkin <andrei.elkin@oracle.com> | 2012-01-18 00:35:53 +0200 |
---|---|---|
committer | Andrei Elkin <andrei.elkin@oracle.com> | 2012-01-18 00:35:53 +0200 |
commit | 8c894564abc55b228cfe9dd87ecde9a7710d94db (patch) | |
tree | 04d9d84b9667740c68112896a735cb7726039cea | |
parent | 7cdd7a7493d080a7e6cce32eb950999fbfd29167 (diff) | |
parent | a72f7ee6a3717f21b7156a5a3dd2d4b034564b4e (diff) | |
download | mariadb-git-8c894564abc55b228cfe9dd87ecde9a7710d94db.tar.gz |
merging from the 5.5 repo to local branch.
-rw-r--r-- | include/my_global.h | 26 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/all_vars.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/character_sets_dir_basic.result | 10 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result | 64 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/innodb_trx_rseg_n_slots_debug_basic.result | 65 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/plugin_dir_basic.result | 10 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/all_vars.test | 4 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/character_sets_dir_basic.test | 19 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test | 52 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test | 53 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 38 | ||||
-rw-r--r-- | sql/mysqld.cc | 6 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 8 | ||||
-rw-r--r-- | sql/sql_udf.cc | 17 |
14 files changed, 343 insertions, 31 deletions
diff --git a/include/my_global.h b/include/my_global.h index 924c83cd951..11ff377c706 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1364,11 +1364,31 @@ do { doubleget_union _tmp; \ #ifndef HAVE_DLERROR #ifdef _WIN32 +#define DLERROR_GENERATE(errmsg, error_number) \ + char win_errormsg[2048]; \ + if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, \ + 0, error_number, 0, win_errormsg, 2048, NULL)) \ + { \ + char *ptr; \ + for (ptr= &win_errormsg[0] + strlen(win_errormsg) - 1; \ + ptr >= &win_errormsg[0] && strchr("\r\n\t\0x20", *ptr); \ + ptr--) \ + *ptr= 0; \ + errmsg= win_errormsg; \ + } \ + else \ + errmsg= "" #define dlerror() "" -#else +#define dlopen_errno GetLastError() +#else /* _WIN32 */ #define dlerror() "No support for dynamic loading (static build?)" -#endif -#endif +#define DLERROR_GENERATE(errmsg, error_number) errmsg= dlerror() +#define dlopen_errno errno +#endif /* _WIN32 */ +#else /* HAVE_DLERROR */ +#define DLERROR_GENERATE(errmsg, error_number) errmsg= dlerror() +#define dlopen_errno errno +#endif /* HAVE_DLERROR */ /* diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result index ee46a155cb0..0f741ff930a 100644 --- a/mysql-test/suite/sys_vars/r/all_vars.result +++ b/mysql-test/suite/sys_vars/r/all_vars.result @@ -3,8 +3,6 @@ create table t2 (variable_name text); load data infile "MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t1; insert into t2 select variable_name from information_schema.global_variables; insert into t2 select variable_name from information_schema.session_variables; -delete from t2 where variable_name='innodb_change_buffering_debug'; -delete from t2 where variable_name='innodb_trx_rseg_n_slots_debug'; update t2 set variable_name= replace(variable_name, "PERFORMANCE_SCHEMA_", "PFS_"); select variable_name as `There should be *no* long test name listed below:` from t2 where length(variable_name) > 50; diff --git a/mysql-test/suite/sys_vars/r/character_sets_dir_basic.result b/mysql-test/suite/sys_vars/r/character_sets_dir_basic.result index c04e5dac199..ef8ec0cd9b8 100644 --- a/mysql-test/suite/sys_vars/r/character_sets_dir_basic.result +++ b/mysql-test/suite/sys_vars/r/character_sets_dir_basic.result @@ -1,20 +1,20 @@ select @@global.character_sets_dir; @@global.character_sets_dir -MYSQL_CHARSETSDIR/ +MYSQL_CHARSETSDIR select @@session.character_sets_dir; ERROR HY000: Variable 'character_sets_dir' is a GLOBAL variable show global variables like 'character_sets_dir'; Variable_name Value -character_sets_dir MYSQL_CHARSETSDIR/ +character_sets_dir MYSQL_CHARSETSDIR show session variables like 'character_sets_dir'; Variable_name Value -character_sets_dir MYSQL_CHARSETSDIR/ +character_sets_dir MYSQL_CHARSETSDIR select * from information_schema.global_variables where variable_name='character_sets_dir'; VARIABLE_NAME VARIABLE_VALUE -CHARACTER_SETS_DIR MYSQL_CHARSETSDIR/ +CHARACTER_SETS_DIR MYSQL_CHARSETSDIR select * from information_schema.session_variables where variable_name='character_sets_dir'; VARIABLE_NAME VARIABLE_VALUE -CHARACTER_SETS_DIR MYSQL_CHARSETSDIR/ +CHARACTER_SETS_DIR MYSQL_CHARSETSDIR set global character_sets_dir="foo"; ERROR HY000: Variable 'character_sets_dir' is a read only variable set session character_sets_dir="foo"; diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result new file mode 100644 index 00000000000..2b74f891050 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result @@ -0,0 +1,64 @@ +SET @start_global_value = @@global.innodb_change_buffering_debug; +SELECT @start_global_value; +@start_global_value +0 +select @@global.innodb_change_buffering_debug in (0, 1); +@@global.innodb_change_buffering_debug in (0, 1) +1 +select @@global.innodb_change_buffering_debug; +@@global.innodb_change_buffering_debug +0 +select @@session.innodb_change_buffering_debug; +ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable +show global variables like 'innodb_change_buffering_debug'; +Variable_name Value +innodb_change_buffering_debug 0 +show session variables like 'innodb_change_buffering_debug'; +Variable_name Value +innodb_change_buffering_debug 0 +select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_CHANGE_BUFFERING_DEBUG 0 +select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_CHANGE_BUFFERING_DEBUG 0 +set global innodb_change_buffering_debug=1; +select @@global.innodb_change_buffering_debug; +@@global.innodb_change_buffering_debug +1 +select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_CHANGE_BUFFERING_DEBUG 1 +select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_CHANGE_BUFFERING_DEBUG 1 +set @@global.innodb_change_buffering_debug=0; +select @@global.innodb_change_buffering_debug; +@@global.innodb_change_buffering_debug +0 +select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_CHANGE_BUFFERING_DEBUG 0 +select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_CHANGE_BUFFERING_DEBUG 0 +set session innodb_change_buffering_debug='some'; +ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable and should be set with SET GLOBAL +set @@session.innodb_change_buffering_debug='some'; +ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_change_buffering_debug=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug' +set global innodb_change_buffering_debug='foo'; +ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug' +set global innodb_change_buffering_debug=-2; +Warnings: +Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '-2' +set global innodb_change_buffering_debug=1e1; +ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug' +set global innodb_change_buffering_debug=2; +Warnings: +Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '2' +SET @@global.innodb_change_buffering_debug = @start_global_value; +SELECT @@global.innodb_change_buffering_debug; +@@global.innodb_change_buffering_debug +0 diff --git a/mysql-test/suite/sys_vars/r/innodb_trx_rseg_n_slots_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_trx_rseg_n_slots_debug_basic.result new file mode 100644 index 00000000000..7e253c869e3 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_trx_rseg_n_slots_debug_basic.result @@ -0,0 +1,65 @@ +SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug; +SELECT @start_global_value; +@start_global_value +0 +select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024; +@@global.innodb_trx_rseg_n_slots_debug between 0 and 1024 +1 +select @@global.innodb_trx_rseg_n_slots_debug; +@@global.innodb_trx_rseg_n_slots_debug +0 +select @@session.innodb_trx_rseg_n_slots_debug; +ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable +show global variables like 'innodb_trx_rseg_n_slots_debug'; +Variable_name Value +innodb_trx_rseg_n_slots_debug 0 +show session variables like 'innodb_trx_rseg_n_slots_debug'; +Variable_name Value +innodb_trx_rseg_n_slots_debug 0 +select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_RSEG_N_SLOTS_DEBUG 0 +select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_RSEG_N_SLOTS_DEBUG 0 +set global innodb_trx_rseg_n_slots_debug=1; +select @@global.innodb_trx_rseg_n_slots_debug; +@@global.innodb_trx_rseg_n_slots_debug +1 +select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_RSEG_N_SLOTS_DEBUG 1 +select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_RSEG_N_SLOTS_DEBUG 1 +set @@global.innodb_trx_rseg_n_slots_debug=0; +select @@global.innodb_trx_rseg_n_slots_debug; +@@global.innodb_trx_rseg_n_slots_debug +0 +select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_RSEG_N_SLOTS_DEBUG 0 +select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_TRX_RSEG_N_SLOTS_DEBUG 0 +set session innodb_trx_rseg_n_slots_debug='some'; +ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable and should be set with SET GLOBAL +set @@session.innodb_trx_rseg_n_slots_debug='some'; +ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_trx_rseg_n_slots_debug=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug' +set global innodb_trx_rseg_n_slots_debug='foo'; +ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug' +set global innodb_trx_rseg_n_slots_debug=-2; +Warnings: +Warning 1292 Truncated incorrect innodb_trx_rseg_n_slots_debug value: '-2' +set global innodb_trx_rseg_n_slots_debug=1e1; +ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug' +set global innodb_trx_rseg_n_slots_debug=1024; +set global innodb_trx_rseg_n_slots_debug=1025; +Warnings: +Warning 1292 Truncated incorrect innodb_trx_rseg_n_slots_debug value: '1025' +SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value; +SELECT @@global.innodb_trx_rseg_n_slots_debug; +@@global.innodb_trx_rseg_n_slots_debug +0 diff --git a/mysql-test/suite/sys_vars/r/plugin_dir_basic.result b/mysql-test/suite/sys_vars/r/plugin_dir_basic.result index a5f36de73fa..e2c03bcad6a 100644 --- a/mysql-test/suite/sys_vars/r/plugin_dir_basic.result +++ b/mysql-test/suite/sys_vars/r/plugin_dir_basic.result @@ -1,20 +1,20 @@ select @@global.plugin_dir; @@global.plugin_dir -MYSQL_TMP_DIR +MYSQL_TMP_DIR/ select @@session.plugin_dir; ERROR HY000: Variable 'plugin_dir' is a GLOBAL variable show global variables like 'plugin_dir'; Variable_name Value -plugin_dir MYSQL_TMP_DIR +plugin_dir MYSQL_TMP_DIR/ show session variables like 'plugin_dir'; Variable_name Value -plugin_dir MYSQL_TMP_DIR +plugin_dir MYSQL_TMP_DIR/ select * from information_schema.global_variables where variable_name='plugin_dir'; VARIABLE_NAME VARIABLE_VALUE -PLUGIN_DIR MYSQL_TMP_DIR +PLUGIN_DIR MYSQL_TMP_DIR/ select * from information_schema.session_variables where variable_name='plugin_dir'; VARIABLE_NAME VARIABLE_VALUE -PLUGIN_DIR MYSQL_TMP_DIR +PLUGIN_DIR MYSQL_TMP_DIR/ set global plugin_dir=1; ERROR HY000: Variable 'plugin_dir' is a read only variable set session plugin_dir=1; diff --git a/mysql-test/suite/sys_vars/t/all_vars.test b/mysql-test/suite/sys_vars/t/all_vars.test index afb74c006e2..2f44ef43493 100644 --- a/mysql-test/suite/sys_vars/t/all_vars.test +++ b/mysql-test/suite/sys_vars/t/all_vars.test @@ -47,10 +47,6 @@ eval load data infile "$MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t insert into t2 select variable_name from information_schema.global_variables; insert into t2 select variable_name from information_schema.session_variables; -# This is only present in debug builds. -delete from t2 where variable_name='innodb_change_buffering_debug'; -delete from t2 where variable_name='innodb_trx_rseg_n_slots_debug'; - # Performance schema variables are too long for files named # 'mysql-test/suite/sys_vars/t/' ... # ... 'performance_schema_events_waits_history_long_size_basic-master.opt' diff --git a/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test b/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test index 3d9de961530..0660fbeba2b 100644 --- a/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test +++ b/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test @@ -1,17 +1,26 @@ # # show the global and session values; # ---replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR + +# workaround to adjust for the directory separators being different in +# different OSes : slash on unixes and backslash or slash on windows. +# TODO: fix with a proper comparison in mysqltest +let $rcd= `SELECT REPLACE('$MYSQL_CHARSETSDIR', '\\\\\', '.')`; +let $rcd= `SELECT REPLACE('$rcd', '/', '.')`; +let $regex_charsetdir= `SELECT '/$rcd[\\\\\/\\\\\]/MYSQL_CHARSETSDIR/'`; + +--replace_regex $regex_charsetdir select @@global.character_sets_dir; + --error ER_INCORRECT_GLOBAL_LOCAL_VAR select @@session.character_sets_dir; ---replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR +--replace_regex $regex_charsetdir show global variables like 'character_sets_dir'; ---replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR +--replace_regex $regex_charsetdir show session variables like 'character_sets_dir'; ---replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR +--replace_regex $regex_charsetdir select * from information_schema.global_variables where variable_name='character_sets_dir'; ---replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR +--replace_regex $regex_charsetdir select * from information_schema.session_variables where variable_name='character_sets_dir'; # diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test new file mode 100644 index 00000000000..ec1065a538e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test @@ -0,0 +1,52 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +SET @start_global_value = @@global.innodb_change_buffering_debug; +SELECT @start_global_value; + +# +# exists as global only +# +select @@global.innodb_change_buffering_debug in (0, 1); +select @@global.innodb_change_buffering_debug; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.innodb_change_buffering_debug; +show global variables like 'innodb_change_buffering_debug'; +show session variables like 'innodb_change_buffering_debug'; +select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; +select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; + +# +# show that it's writable +# +set global innodb_change_buffering_debug=1; +select @@global.innodb_change_buffering_debug; +select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; +select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; +set @@global.innodb_change_buffering_debug=0; +select @@global.innodb_change_buffering_debug; +select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; +select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; +--error ER_GLOBAL_VARIABLE +set session innodb_change_buffering_debug='some'; +--error ER_GLOBAL_VARIABLE +set @@session.innodb_change_buffering_debug='some'; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_change_buffering_debug=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_change_buffering_debug='foo'; +set global innodb_change_buffering_debug=-2; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_change_buffering_debug=1e1; +set global innodb_change_buffering_debug=2; + +# +# Cleanup +# + +SET @@global.innodb_change_buffering_debug = @start_global_value; +SELECT @@global.innodb_change_buffering_debug; diff --git a/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test new file mode 100644 index 00000000000..d17917de8e9 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test @@ -0,0 +1,53 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug; +SELECT @start_global_value; + +# +# exists as global only +# +select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024; +select @@global.innodb_trx_rseg_n_slots_debug; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.innodb_trx_rseg_n_slots_debug; +show global variables like 'innodb_trx_rseg_n_slots_debug'; +show session variables like 'innodb_trx_rseg_n_slots_debug'; +select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug'; + +# +# show that it's writable +# +set global innodb_trx_rseg_n_slots_debug=1; +select @@global.innodb_trx_rseg_n_slots_debug; +select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +set @@global.innodb_trx_rseg_n_slots_debug=0; +select @@global.innodb_trx_rseg_n_slots_debug; +select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug'; +--error ER_GLOBAL_VARIABLE +set session innodb_trx_rseg_n_slots_debug='some'; +--error ER_GLOBAL_VARIABLE +set @@session.innodb_trx_rseg_n_slots_debug='some'; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_trx_rseg_n_slots_debug=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_trx_rseg_n_slots_debug='foo'; +set global innodb_trx_rseg_n_slots_debug=-2; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_trx_rseg_n_slots_debug=1e1; +set global innodb_trx_rseg_n_slots_debug=1024; +set global innodb_trx_rseg_n_slots_debug=1025; + +# +# Cleanup +# + +SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value; +SELECT @@global.innodb_trx_rseg_n_slots_debug; diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 0d2045a65a6..37e0e351ccd 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -740,17 +740,55 @@ cmd="$cmd $args" test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null" log_notice "Starting $MYSQLD daemon with databases from $DATADIR" + +# variable to track the current number of "fast" (a.k.a. subsecond) restarts +fast_restart=0 +# maximum number of restarts before trottling kicks in +max_fast_restarts=5 +# flag whether a usable sleep command exists +have_sleep=1 + while true do rm -f $safe_mysql_unix_port "$pid_file" # Some extra safety + start_time=`date +%M%S` + eval_log_error "$cmd" + end_time=`date +%M%S` + if test ! -f "$pid_file" # This is removed if normal shutdown then break fi + + # sanity check if time reading is sane and there's sleep + if test $end_time -gt 0 -a $have_sleep -gt 0 + then + # throttle down the fast restarts + if test $end_time -eq $start_time + then + fast_restart=`expr $fast_restart + 1` + if test $fast_restart -ge $max_fast_restarts + then + log_notice "The server is respawning too fast. Sleeping for 1 second." + sleep 1 + sleep_state=$? + if test $sleep_state -gt 0 + then + log_notice "The server is respawning too fast and no working sleep command. Turning off trottling." + have_sleep=0 + fi + + fast_restart=0 + fi + else + fast_restart=0 + fi + fi + if @TARGET_LINUX@ && test $KILL_MYSQLD -eq 1 then # Test if one process was hanging. diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6afc20141e1..31257777b27 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7476,8 +7476,10 @@ static int fix_paths(void) (void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir (void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home); (void) my_load_path(pidfile_name, pidfile_name_ptr, mysql_real_data_home); - (void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr : - get_relative_path(PLUGINDIR), mysql_home); + + convert_dirname(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr : + get_relative_path(PLUGINDIR), NullS); + (void) my_load_path(opt_plugin_dir, opt_plugin_dir, mysql_home); opt_plugin_dir_ptr= opt_plugin_dir; my_realpath(mysql_unpacked_real_data_home, mysql_real_data_home, MYF(0)); diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 2b801b65a09..4a2d450f373 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -463,18 +463,22 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) dlpathlen= strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", dl->str, NullS) - dlpath; + (void) unpack_filename(dlpath, dlpath); plugin_dl.ref_count= 1; /* Open new dll handle */ if (!(plugin_dl.handle= dlopen(dlpath, RTLD_NOW))) { - const char *errmsg=dlerror(); + const char *errmsg; + int error_number= dlopen_errno; + DLERROR_GENERATE(errmsg, error_number); + if (!strncmp(dlpath, errmsg, dlpathlen)) { // if errmsg starts from dlpath, trim this prefix. errmsg+=dlpathlen; if (*errmsg == ':') errmsg++; if (*errmsg == ' ') errmsg++; } - report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, errno, errmsg); + report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, error_number, errmsg); DBUG_RETURN(0); } /* Determine interface version */ diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index bf2de4b39bb..44595ace453 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -221,10 +221,15 @@ void udf_init() char dlpath[FN_REFLEN]; strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", tmp->dl, NullS); + (void) unpack_filename(dlpath, dlpath); if (!(dl= dlopen(dlpath, RTLD_NOW))) { + const char *errmsg; + int error_number= dlopen_errno; + DLERROR_GENERATE(errmsg, error_number); + /* Print warning to log */ - sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl, errno, dlerror()); + sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl, error_number, errmsg); /* Keep the udf in the hash so that we can remove it later */ continue; } @@ -469,12 +474,18 @@ int mysql_create_function(THD *thd,udf_func *udf) { char dlpath[FN_REFLEN]; strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", udf->dl, NullS); + (void) unpack_filename(dlpath, dlpath); + if (!(dl = dlopen(dlpath, RTLD_NOW))) { + const char *errmsg; + int error_number= dlopen_errno; + DLERROR_GENERATE(errmsg, error_number); + DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)", - udf->dl, errno, dlerror())); + udf->dl, error_number, errmsg)); my_error(ER_CANT_OPEN_LIBRARY, MYF(0), - udf->dl, errno, dlerror()); + udf->dl, error_number, errmsg); goto err; } new_dl=1; |