Commit 84d9d286 authored by Sergei Golubchik's avatar Sergei Golubchik

use log-error in mtr, don't let mysqld to write to stderr

because on Windows it cannot properly append to the file,
doesn't use CreateFile(..., FILE_APPEND_DATA, ...)

this fixes main.shutdown failures on Windows
parent cd79be82
......@@ -246,7 +246,7 @@ my @mysqld_rules=
{ '#host' => \&fix_host },
{ 'port' => \&fix_port },
{ 'socket' => \&fix_socket },
{ '#log-error' => \&fix_log_error },
{ 'log-error' => \&fix_log_error },
{ 'general-log' => 1 },
{ 'plugin-dir' => sub { $::plugindir } },
{ 'general-log-file' => \&fix_log },
......@@ -394,7 +394,7 @@ sub post_check_embedded_group {
my %no_copy = map { $_ => 1 }
(
'#log-error', # Embedded server writes stderr to mysqltest's log file
'log-error', # Embedded server writes stderr to mysqltest's log file
'slave-net-timeout', # Embedded server are not build with replication
'shared-memory-base-name', # No shared memory for embedded
);
......
......@@ -2757,7 +2757,7 @@ sub mysql_server_start($) {
# Already started
# Write start of testcase to log file
mark_log($mysqld->value('#log-error'), $tinfo);
mark_log($mysqld->value('log-error'), $tinfo);
return;
}
......@@ -2814,7 +2814,7 @@ sub mysql_server_start($) {
mkpath($tmpdir) unless -d $tmpdir;
# Write start of testcase to log file
mark_log($mysqld->value('#log-error'), $tinfo);
mark_log($mysqld->value('log-error'), $tinfo);
# Run <tname>-master.sh
if ($mysqld->option('#!run-master-sh') and
......@@ -4259,7 +4259,7 @@ sub get_log_from_proc ($$) {
foreach my $mysqld (all_servers()) {
if ($mysqld->{proc} eq $proc) {
my @srv_lines= extract_server_log($mysqld->if_exist('#log-error'), $name);
my @srv_lines= extract_server_log($mysqld->if_exist('log-error'), $name);
$srv_log= "\nServer log from this test:\n" .
"----------SERVER LOG START-----------\n". join ("", @srv_lines) .
"----------SERVER LOG END-------------\n";
......@@ -4466,7 +4466,7 @@ sub start_check_warnings ($$) {
my $name= "warnings-".$mysqld->name();
my $log_error= $mysqld->value('#log-error');
my $log_error= $mysqld->value('log-error');
# To be communicated to the test
$ENV{MTR_LOG_ERROR}= $log_error;
extract_warning_lines($log_error, 0);
......@@ -4624,7 +4624,7 @@ sub check_warnings_post_shutdown {
foreach my $mysqld ( mysqlds())
{
my ($testlist, $match_lines)=
extract_warning_lines($mysqld->value('#log-error'), 1);
extract_warning_lines($mysqld->value('log-error'), 1);
$testname_hash->{$_}= 1 for @$testlist;
$report.= join('', @$match_lines);
}
......@@ -5073,7 +5073,7 @@ sub mysqld_start ($$) {
# Remove the old pidfile if any
unlink($mysqld->value('pid-file'));
my $output= $mysqld->value('#log-error');
my $output= $mysqld->value('log-error');
if ( $opt_valgrind and $opt_debug )
{
......
select @@global.log_error;
@@global.log_error
select @@session.log_error;
ERROR HY000: Variable 'log_error' is a GLOBAL variable
show global variables like 'log_error';
Variable_name Value
log_error
show session variables like 'log_error';
Variable_name Value
log_error
select * from information_schema.global_variables where variable_name='log_error';
VARIABLE_NAME VARIABLE_VALUE
LOG_ERROR
select * from information_schema.session_variables where variable_name='log_error';
VARIABLE_NAME VARIABLE_VALUE
LOG_ERROR
set global log_error=1;
ERROR HY000: Variable 'log_error' is a read only variable
set session log_error=1;
ERROR HY000: Variable 'log_error' is a read only variable
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
select instr(@err_log, "mysqld.1.err")>0;
instr(@err_log, "mysqld.1.err")>0
1
......@@ -1817,8 +1817,8 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME LOG_ERROR
SESSION_VALUE NULL
GLOBAL_VALUE
GLOBAL_VALUE_ORIGIN COMPILE-TIME
GLOBAL_VALUE PATH
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
......
#
# only global
#
select @@global.log_error;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.log_error;
show global variables like 'log_error';
show session variables like 'log_error';
select * from information_schema.global_variables where variable_name='log_error';
select * from information_schema.session_variables where variable_name='log_error';
#
# show that it's read-only
#
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set global log_error=1;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set session log_error=1;
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
[mysqld.1]
log-error=some_random_name5435413
# embedded .cnf doesn't have log-error option
source include/not_embedded.inc;
# 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;
select instr(@err_log, "mysqld.1.err")>0;
# Check file's existence. The displayed value may be relative or not.
let $err_log=`select @err_log`;
......
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
[mysqld.1]
log-error
......@@ -18,7 +18,7 @@ FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_name = 'innodb';
--source include/wait_until_disconnected.inc
--error 1
--exec $MYSQLD_CMD --innodb=force --innodb-page-size=6000
--exec $MYSQLD_CMD --innodb=force --innodb-page-size=6000 --disable-log-error
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment