Commit 6293a2ea 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

mysql-test/include/check-warnings.test:
  Since server doesn't have log-error, get it from env. var. set by MTR
mysql-test/lib/My/ConfigFactory.pm:
  "Hide" log-error in a comment
mysql-test/mysql-test-run.pl:
  "Hide" log-error in my.cnf by comment
  add --console to arguments on Windows
  Move .err file to var/log
parent 09008516
......@@ -26,7 +26,7 @@ create temporary table error_log (
) engine=myisam;
# 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;
# Try tload the warnings into a temporary table,
......
......@@ -116,8 +116,8 @@ sub fix_tmpdir {
sub fix_log_error {
my ($self, $config, $group_name, $group)= @_;
my $dir= dirname($group->value('datadir'));
return "$dir/mysqld.err";
my $dir= $self->{ARGS}->{vardir};
return "$dir/log/$group_name.err";
}
sub fix_log {
......@@ -203,7 +203,7 @@ my @mysqld_rules=
{ '#host' => \&fix_host },
{ 'port' => \&fix_port },
{ 'socket' => \&fix_socket },
{ 'log-error' => \&fix_log_error },
{ '#log-error' => \&fix_log_error },
{ 'log' => \&fix_log },
{ 'log-slow-queries' => \&fix_log_slow_queries },
{ '#user' => sub { return shift->{ARGS}->{user} || ""; } },
......@@ -389,7 +389,7 @@ sub post_check_embedded_group {
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
);
......
......@@ -3470,7 +3470,10 @@ sub start_check_warnings ($$) {
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;
mtr_init_args(\$args);
......@@ -3986,6 +3989,12 @@ sub mysqld_start ($$) {
$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 )
{
gdb_arguments(\$args, \$exe, $mysqld->name());
......@@ -4018,7 +4027,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 )
{
# When both --valgrind and --debug is selected, send
......@@ -4319,7 +4328,7 @@ sub start_servers($) {
# Already started
# Write start of testcase to log file
mark_log($mysqld->value('log-error'), $tinfo);
mark_log($mysqld->value('#log-error'), $tinfo);
next;
}
......@@ -4378,7 +4387,7 @@ sub start_servers($) {
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
......@@ -4429,7 +4438,7 @@ sub start_servers($) {
$tinfo->{comment}=
"Failed to start ".$mysqld->name();
my $logfile= $mysqld->value('log-error');
my $logfile= $mysqld->value('#log-error');
if ( defined $logfile and -f $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