diff options
author | Guilhem Bichot <guilhem@mysql.com> | 2010-03-05 14:08:21 +0100 |
---|---|---|
committer | Guilhem Bichot <guilhem@mysql.com> | 2010-03-05 14:08:21 +0100 |
commit | 7bb4e5b459d956a5fa0c62f4c230181cfc72e913 (patch) | |
tree | bea9045dc83fdcd27b60b2ef9098d9118d767b08 /mysql-test | |
parent | 16dfa2b16f6c49695536885c85d3fa3dccb9d1a1 (diff) | |
download | mariadb-git-7bb4e5b459d956a5fa0c62f4c230181cfc72e913.tar.gz |
Fix for BUG#51215 "log-error partially works with version 5.5": WL 4738 (reengineering of server variables)
had broken the 5.1 behaviour of --log-error: --log-error without argument sent to stderr instead of writing
to a file with an autogenerated name.
mysql-test/suite/sys_vars/t/log_error_func.test:
test that error log is created and shown in SHOW VARIABLES.
Interestingly the error log's path is apparently relative if --log-error=argument is used, but
may be absolute or relative if --log-error(no argument) is used (because then the path is derived from
that of pidfile_name, which can be absolute or relative, depending on if autogenerated or not).
mysql-test/suite/sys_vars/t/log_error_func2.test:
test that error log is created and shown in SHOW VARIABLES
mysql-test/suite/sys_vars/t/log_error_func3.test:
test that error log is empty in SHOW VARIABLES
sql/mysql_priv.h:
id for option --log-error
sql/mysqld.cc:
No --log-error means "write errors to stderr", whereas --log-error
without argument means "write errors to a file". So we cannot use the default logic
of class sys_var_charptr, which treats "option not used" the same as "option used
without argument" and uses the same default for both. We need to catch "option used",
in mysqld_get_one_option(), and then "without argument". Setting to "" makes sure
that init_server_components() will create the log, with an autogenerated name.
sql/sys_vars.cc:
need to give the option a numeric id so that we can catch it in mysqld_get_one_option()
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/suite/sys_vars/r/log_error_func.result | 6 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/log_error_func2.result | 6 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/log_error_func3.result | 3 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/log_error_func.cnf | 5 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/log_error_func.test | 20 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/log_error_func2.cnf | 5 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/log_error_func2.test | 20 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/log_error_func3.test | 5 |
8 files changed, 70 insertions, 0 deletions
diff --git a/mysql-test/suite/sys_vars/r/log_error_func.result b/mysql-test/suite/sys_vars/r/log_error_func.result new file mode 100644 index 00000000000..c787c5ceb4f --- /dev/null +++ b/mysql-test/suite/sys_vars/r/log_error_func.result @@ -0,0 +1,6 @@ +select (@err_log:=variable_value)*0 from information_schema.global_variables where variable_name="log_error"; +(@err_log:=variable_value)*0 +0 +select instr(@err_log, "some_random_name5435413.err")>0; +instr(@err_log, "some_random_name5435413.err")>0 +1 diff --git a/mysql-test/suite/sys_vars/r/log_error_func2.result b/mysql-test/suite/sys_vars/r/log_error_func2.result new file mode 100644 index 00000000000..82720035886 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/log_error_func2.result @@ -0,0 +1,6 @@ +select (@err_log:=variable_value)*0 from information_schema.global_variables where variable_name="log_error"; +(@err_log:=variable_value)*0 +0 +select instr(@err_log, ".err")>0; +instr(@err_log, ".err")>0 +1 diff --git a/mysql-test/suite/sys_vars/r/log_error_func3.result b/mysql-test/suite/sys_vars/r/log_error_func3.result new file mode 100644 index 00000000000..ff1908defd1 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/log_error_func3.result @@ -0,0 +1,3 @@ +select variable_value from information_schema.global_variables where variable_name="log_error"; +variable_value + diff --git a/mysql-test/suite/sys_vars/t/log_error_func.cnf b/mysql-test/suite/sys_vars/t/log_error_func.cnf new file mode 100644 index 00000000000..7a030b5518d --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_error_func.cnf @@ -0,0 +1,5 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld.1] +log-error=some_random_name5435413 diff --git a/mysql-test/suite/sys_vars/t/log_error_func.test b/mysql-test/suite/sys_vars/t/log_error_func.test new file mode 100644 index 00000000000..1cd45a54ff7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_error_func.test @@ -0,0 +1,20 @@ +# Test for BUG#51215 "log-error partially works with version 5.5" +# when --log-error is used without argument + +# check displayed value. We can check only the base name, the rest +# depends on paths, symbolic links, --vardir, etc... +select (@err_log:=variable_value)*0 from information_schema.global_variables where variable_name="log_error"; +select instr(@err_log, "some_random_name5435413.err")>0; + +# Check file's existence. The displayed value may be relative or not. +let $err_log=`select @err_log`; +let $err_log_relative=`select instr(@err_log, ".")=1`; +if ($err_log_relative) +{ + let $MYSQLD_DATADIR= `SELECT @@datadir`; + file_exists $MYSQLD_DATADIR/$err_log; +} +if (!$err_log_relative) +{ + file_exists $err_log; +} diff --git a/mysql-test/suite/sys_vars/t/log_error_func2.cnf b/mysql-test/suite/sys_vars/t/log_error_func2.cnf new file mode 100644 index 00000000000..ff7e8f7a101 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_error_func2.cnf @@ -0,0 +1,5 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld.1] +log-error diff --git a/mysql-test/suite/sys_vars/t/log_error_func2.test b/mysql-test/suite/sys_vars/t/log_error_func2.test new file mode 100644 index 00000000000..e9f91e9c032 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_error_func2.test @@ -0,0 +1,20 @@ +# Test for BUG#51215 "log-error partially works with version 5.5" +# when --log-error is used without argument + +# check displayed value. We can check only the suffix, because +# the rest depends on paths, symbolic links, --vardir, etc... +select (@err_log:=variable_value)*0 from information_schema.global_variables where variable_name="log_error"; +select instr(@err_log, ".err")>0; + +# Check file's existence. The displayed value may be relative or not. +let $err_log=`select @err_log`; +let $err_log_relative=`select instr(@err_log, ".")=1`; +if ($err_log_relative) +{ + let $MYSQLD_DATADIR= `SELECT @@datadir`; + file_exists $MYSQLD_DATADIR/$err_log; +} +if (!$err_log_relative) +{ + file_exists $err_log; +} diff --git a/mysql-test/suite/sys_vars/t/log_error_func3.test b/mysql-test/suite/sys_vars/t/log_error_func3.test new file mode 100644 index 00000000000..c6b076f39fb --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_error_func3.test @@ -0,0 +1,5 @@ +# Test for BUG#51215 "log-error partially works with version 5.5" +# when --log-error is not used + +# check displayed value. Should be empty. +select variable_value from information_schema.global_variables where variable_name="log_error"; |