mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
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.
This commit is contained in:
parent
dad94c24af
commit
39e30ed9e0
11 changed files with 87 additions and 2 deletions
6
mysql-test/suite/sys_vars/r/log_error_func.result
Normal file
6
mysql-test/suite/sys_vars/r/log_error_func.result
Normal file
|
@ -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
|
6
mysql-test/suite/sys_vars/r/log_error_func2.result
Normal file
6
mysql-test/suite/sys_vars/r/log_error_func2.result
Normal file
|
@ -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
|
3
mysql-test/suite/sys_vars/r/log_error_func3.result
Normal file
3
mysql-test/suite/sys_vars/r/log_error_func3.result
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
select variable_value from information_schema.global_variables where variable_name="log_error";
|
||||||
|
variable_value
|
||||||
|
|
5
mysql-test/suite/sys_vars/t/log_error_func.cnf
Normal file
5
mysql-test/suite/sys_vars/t/log_error_func.cnf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Use default setting for mysqld processes
|
||||||
|
!include include/default_mysqld.cnf
|
||||||
|
|
||||||
|
[mysqld.1]
|
||||||
|
log-error=some_random_name5435413
|
20
mysql-test/suite/sys_vars/t/log_error_func.test
Normal file
20
mysql-test/suite/sys_vars/t/log_error_func.test
Normal file
|
@ -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;
|
||||||
|
}
|
5
mysql-test/suite/sys_vars/t/log_error_func2.cnf
Normal file
5
mysql-test/suite/sys_vars/t/log_error_func2.cnf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Use default setting for mysqld processes
|
||||||
|
!include include/default_mysqld.cnf
|
||||||
|
|
||||||
|
[mysqld.1]
|
||||||
|
log-error
|
20
mysql-test/suite/sys_vars/t/log_error_func2.test
Normal file
20
mysql-test/suite/sys_vars/t/log_error_func2.test
Normal file
|
@ -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;
|
||||||
|
}
|
5
mysql-test/suite/sys_vars/t/log_error_func3.test
Normal file
5
mysql-test/suite/sys_vars/t/log_error_func3.test
Normal file
|
@ -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";
|
|
@ -2687,7 +2687,8 @@ enum options_mysqld
|
||||||
OPT_SSL_CIPHER,
|
OPT_SSL_CIPHER,
|
||||||
OPT_SSL_KEY,
|
OPT_SSL_KEY,
|
||||||
OPT_WANT_CORE,
|
OPT_WANT_CORE,
|
||||||
OPT_ENGINE_CONDITION_PUSHDOWN
|
OPT_ENGINE_CONDITION_PUSHDOWN,
|
||||||
|
OPT_LOG_ERROR
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MYSQL_SERVER */
|
#endif /* MYSQL_SERVER */
|
||||||
|
|
|
@ -3962,6 +3962,11 @@ static int init_server_components()
|
||||||
else
|
else
|
||||||
fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err",
|
fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err",
|
||||||
MY_UNPACK_FILENAME | MY_SAFE_PATH);
|
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])
|
if (!log_error_file[0])
|
||||||
opt_error_log= 0; // Too long file name
|
opt_error_log= 0; // Too long file name
|
||||||
else
|
else
|
||||||
|
@ -7357,6 +7362,14 @@ mysqld_get_one_option(int optid,
|
||||||
global_system_variables.optimizer_switch&=
|
global_system_variables.optimizer_switch&=
|
||||||
~OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN;
|
~OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN;
|
||||||
break;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -895,7 +895,8 @@ static Sys_var_mybool Sys_trust_function_creators(
|
||||||
|
|
||||||
static Sys_var_charptr Sys_log_error(
|
static Sys_var_charptr Sys_log_error(
|
||||||
"log_error", "Error log file",
|
"log_error", "Error log file",
|
||||||
READ_ONLY GLOBAL_VAR(log_error_file_ptr), CMD_LINE(OPT_ARG),
|
READ_ONLY GLOBAL_VAR(log_error_file_ptr),
|
||||||
|
CMD_LINE(OPT_ARG, OPT_LOG_ERROR),
|
||||||
IN_FS_CHARSET, DEFAULT(disabled_my_option));
|
IN_FS_CHARSET, DEFAULT(disabled_my_option));
|
||||||
|
|
||||||
static Sys_var_mybool Sys_log_queries_not_using_indexes(
|
static Sys_var_mybool Sys_log_queries_not_using_indexes(
|
||||||
|
|
Loading…
Add table
Reference in a new issue