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 /sql/mysqld.cc | |
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 'sql/mysqld.cc')
-rw-r--r-- | sql/mysqld.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2e908eb3366..37713992a90 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3962,6 +3962,11 @@ static int init_server_components() else fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err", MY_UNPACK_FILENAME | MY_SAFE_PATH); + /* + _ptr may have been set to my_disabled_option or "" if no argument was + passed, but we need to show the real name in SHOW VARIABLES: + */ + log_error_file_ptr= log_error_file; if (!log_error_file[0]) opt_error_log= 0; // Too long file name else @@ -7357,6 +7362,14 @@ mysqld_get_one_option(int optid, global_system_variables.optimizer_switch&= ~OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN; break; + case OPT_LOG_ERROR: + /* + "No --log-error" == "write errors to stderr", + "--log-error without argument" == "write errors to a file". + */ + if (argument == NULL) /* no argument */ + log_error_file_ptr= const_cast<char*>(""); + break; } return 0; } |