Commit 0314eb7e authored by Bjorn Munch's avatar Bjorn Munch

Bug #40978 Error log gets truncated during testsuite, prevents debugging

Error log gets truncated when mysqld is restarted by MTR
parent a892ad5c
...@@ -26,7 +26,7 @@ create temporary table error_log ( ...@@ -26,7 +26,7 @@ create temporary table error_log (
) engine=myisam; ) engine=myisam;
# Get the name of servers error log # Get the name of servers error log
let $log_error= query_get_value(show variables like 'log_error', Value, 1); let $log_error= $MTR_LOG_ERROR;
let $log_warning= $log_error.warnings; let $log_warning= $log_error.warnings;
# Try tload the warnings into a temporary table, # Try tload the warnings into a temporary table,
......
...@@ -116,8 +116,8 @@ sub fix_tmpdir { ...@@ -116,8 +116,8 @@ sub fix_tmpdir {
sub fix_log_error { sub fix_log_error {
my ($self, $config, $group_name, $group)= @_; my ($self, $config, $group_name, $group)= @_;
my $dir= dirname($group->value('datadir')); my $dir= $self->{ARGS}->{vardir};
return "$dir/mysqld.err"; return "$dir/log/$group_name.err";
} }
sub fix_log { sub fix_log {
...@@ -203,7 +203,7 @@ my @mysqld_rules= ...@@ -203,7 +203,7 @@ my @mysqld_rules=
{ '#host' => \&fix_host }, { '#host' => \&fix_host },
{ 'port' => \&fix_port }, { 'port' => \&fix_port },
{ 'socket' => \&fix_socket }, { 'socket' => \&fix_socket },
{ 'log-error' => \&fix_log_error }, { '#log-error' => \&fix_log_error },
{ 'log' => \&fix_log }, { 'log' => \&fix_log },
{ 'log-slow-queries' => \&fix_log_slow_queries }, { 'log-slow-queries' => \&fix_log_slow_queries },
{ '#user' => sub { return shift->{ARGS}->{user} || ""; } }, { '#user' => sub { return shift->{ARGS}->{user} || ""; } },
...@@ -389,7 +389,7 @@ sub post_check_embedded_group { ...@@ -389,7 +389,7 @@ sub post_check_embedded_group {
my @no_copy = my @no_copy =
( (
'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 'slave-net-timeout', # Embedded server are not build with replication
); );
......
...@@ -3470,7 +3470,10 @@ sub start_check_warnings ($$) { ...@@ -3470,7 +3470,10 @@ sub start_check_warnings ($$) {
my $name= "warnings-".$mysqld->name(); my $name= "warnings-".$mysqld->name();
extract_warning_lines($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);
my $args; my $args;
mtr_init_args(\$args); mtr_init_args(\$args);
...@@ -3986,6 +3989,12 @@ sub mysqld_start ($$) { ...@@ -3986,6 +3989,12 @@ sub mysqld_start ($$) {
$path_vardir_trace, $mysqld->name()); $path_vardir_trace, $mysqld->name());
} }
if (IS_WINDOWS)
{
# Trick the server to send output to stderr, with --console
mtr_add_arg($args, "--console");
}
if ( $opt_gdb || $opt_manual_gdb ) if ( $opt_gdb || $opt_manual_gdb )
{ {
gdb_arguments(\$args, \$exe, $mysqld->name()); gdb_arguments(\$args, \$exe, $mysqld->name());
...@@ -4018,7 +4027,7 @@ sub mysqld_start ($$) { ...@@ -4018,7 +4027,7 @@ sub mysqld_start ($$) {
# Remove the old pidfile if any # Remove the old pidfile if any
unlink($mysqld->value('pid-file')); unlink($mysqld->value('pid-file'));
my $output= $mysqld->value('log-error'); my $output= $mysqld->value('#log-error');
if ( $opt_valgrind and $opt_debug ) if ( $opt_valgrind and $opt_debug )
{ {
# When both --valgrind and --debug is selected, send # When both --valgrind and --debug is selected, send
...@@ -4319,7 +4328,7 @@ sub start_servers($) { ...@@ -4319,7 +4328,7 @@ sub start_servers($) {
# Already started # Already started
# Write start of testcase to log file # Write start of testcase to log file
mark_log($mysqld->value('log-error'), $tinfo); mark_log($mysqld->value('#log-error'), $tinfo);
next; next;
} }
...@@ -4378,7 +4387,7 @@ sub start_servers($) { ...@@ -4378,7 +4387,7 @@ sub start_servers($) {
mkpath($tmpdir) unless -d $tmpdir; mkpath($tmpdir) unless -d $tmpdir;
# Write start of testcase to log file # 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 # Run <tname>-master.sh
if ($mysqld->option('#!run-master-sh') and if ($mysqld->option('#!run-master-sh') and
...@@ -4429,7 +4438,7 @@ sub start_servers($) { ...@@ -4429,7 +4438,7 @@ sub start_servers($) {
$tinfo->{comment}= $tinfo->{comment}=
"Failed to start ".$mysqld->name(); "Failed to start ".$mysqld->name();
my $logfile= $mysqld->value('log-error'); my $logfile= $mysqld->value('#log-error');
if ( defined $logfile and -f $logfile ) if ( defined $logfile and -f $logfile )
{ {
$tinfo->{logfile}= mtr_fromfile($logfile); $tinfo->{logfile}= mtr_fromfile($logfile);
......
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